Unix administration - i add a user remotely but cannot login with ssh

This is Interesting: Free IT Magazines  
Home > Archive > Unix administration > January 2004 > i add a user remotely but cannot login with ssh





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author i add a user remotely but cannot login with ssh
rockone

2004-01-23, 4:51 pm


i login a pc(redhat9 OS) with ssh

and add a user foo

but i cannot login the pc by user foo with ssh remotely



add user cmd as bellow:

# /usr/sbin/useradd -p passwd foo

# passwd -u foo



thank you advanced!


--
Posted via http://mcse.ms
Chris F.A. Johnson

2004-01-23, 4:51 pm

On Sun, 19 Oct 2003 at 04:04 GMT, rockone wrote:
quote:

>
> i login a pc(redhat9 OS) with ssh
>
> and add a user foo
>
> but i cannot login the pc by user foo with ssh remotely
>
>
>
> add user cmd as bellow:
>
> # /usr/sbin/useradd -p passwd foo
>
> # passwd -u foo



man useradd:

-p passwd
The encrypted password, as returned by crypt(3). The default is
to disable the account.

--
Chris F.A. Johnson http://cfaj.freeshell.org
========================================
===========================
My code (if any) in this post is copyright 2003, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License
rockone

2004-01-23, 4:51 pm



quote:

>-p passwd


quote:

>


quote:

>The encrypted password, as returned by crypt(3).


quote:

>


quote:

>The default is to disable the account.


quote:

>





but cmd "passwd -u foo" is unlock it


--
Posted via http://mcse.ms
Chris F.A. Johnson

2004-01-23, 4:51 pm

On Sun, 19 Oct 2003 at 05:52 GMT, rockone wrote:
quote:

>
>
>
>
> but cmd "passwd -u foo" is unlock it



But you didn't use an ENCRYPTED password.
You used a plain text password.

--
Chris F.A. Johnson http://cfaj.freeshell.org
========================================
===========================
My code (if any) in this post is copyright 2003, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License
rockone

2004-01-23, 4:51 pm


thank you, now i know the reason.

but can you tell me how to make it?


--
Posted via http://mcse.ms
Chris F.A. Johnson

2004-01-23, 4:51 pm

On Sun, 19 Oct 2003 at 08:38 GMT, rockone wrote:
quote:

>
> thank you, now i know the reason.
>
> but can you tell me how to make it?



Either use a command (e.g.: "htpasswd -n USER | cut -d: -f2") or
language (Perl, perhaps?) which has an interface to the crypt(3)
function, or compile one. I use this C program:

/* crypt.c */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>

int
main(int argc, char *argv[])
{
char buf[1024];
char *salt;

if (argc > 1)
{
salt = argv[1];
}
else
{
salt = "$1$!@#$%^&*";
}

while (fgets(buf,sizeof(buf),stdin))
{
if ( buf[strlen(buf)-1] == '\n' )
{
buf[strlen(buf) - 1] = '\0';
}
printf( "%s\n", crypt(buf,salt));
}

return 0;
}


Usage: crypt [SALT]

The plain text password is passed to it on stdin, e.g.:

echo passwd | crypt xx

--
Chris F.A. Johnson http://cfaj.freeshell.org
========================================
===========================
My code (if any) in this post is copyright 2003, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License
rockone

2004-01-23, 4:51 pm


Thank you very much!



i also find bellow is ok.



1. login with ssh

2. su to root

3. passwd foo


--
Posted via http://mcse.ms
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com