Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I have an ubuntu virtual server (Hardy) with ProFTPD 1.3.1 Server (Debian) installed and running correctly, however when i add a new user using the command:
# useradd -m -d /home/ftp/ -p password username
I cannot ftp into the account, it says i have an incorrect password. I need to be able to use the -p switch as otherwise i would have to give public users access to the passwd command which is obviously a great security risk. using useradd poses a lot less risk!
If i do use the passwd command then everything works as expected
open(USERLIST, "userlist") or die "Failed to open userlist file\n";
my($user, $pass, $other)=split(/ /, $_);
my $enc_pass=crypt($pass, $SALT);
# system("/etc/sbin/useradd -p $enc_pass $user");
print("/etc/sbin/useradd -p $enc_pass $user\n");
This was to create multiple users from a Text file, but could easily be modified for your own use.
now adduser as normal point to desire home path
but shell user as /usr/bin/passwd
1)user can have ftp home login
2)user able to change pass login with ssh
- because when user ssh to the system , system only ask for
- to change password , with no others facility
Thanks for the reply routers and i would do as you suggest if it were possible, however the users who this is being aimed at will not want to or be able to ssh into the server at all, it is only for ftp access! The form is filled out on a web page, checked and verified, then they are given an ftp only account. Since it is a web app php/apache has to run the command, the security holes of allowing php/apache to have access to passwd is too great, whereas allowing it to create a new user as long as all info is properly screened is a lot less so. Hence the reason i need to get the --password switch to work on the useradd command!
If you or anybody else could help me understand why the --password switch does not work as it should (afaik). As far as i understand the man pages, the password switch is supposed to enable the account using that password, but it seems to be ignoring it completely and using the default setting of disabling the account until passwd is used!
The -p option for useradd is for passing an encrypted password.
This means that you should be typing something like:
useradd -p $1$easthgaGA$tes2b4426436y username
useradd -p mypassword username
Thanks a lot Disillusionist i will try this solution next, and thanks for the sample code!
Are you scripting the user creation? If not, is it that much work to run passwd as a second phase to the user creation?
As i replied to Router, the issue is that this is running as a web app php/apache and the security implications of allowing the webserver run passwd is just too great. I am able to give sudo access to the webserver for specific commands, but i don't want to give it that one as some malicious person of ill intent / granny with a keyboard could change root passwords etc.