Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
 

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Adding a user non-interactively?, Want to setup a head/disk-less FTPserver< Next Oldest | Next Newest >
johnbo Offline





Group: Members
Posts: 3
Joined: Jan. 2005
Posted: Jan. 13 2005,08:08 QUOTE

Hi,

I've been following this forum for the last couple of days as I've been trying the DSL 0.9.2. I'm very impressed, both with DSL and the forum.

I'm trying to build a box that will boot off a CD (easy), run a web server on fixed content (easy), and run an FTP server also with an initially fixed content (not so easy). There is no hardware, no USB, no display, no keyboard. Just a mini-ITX board, a CDROM and a network cable. This will eventually be used as a demo tool for our products.

It appears that the problem that I'm running into (other than a minor shortage of Linux/Unix background), is that I need to have a specific username and password that is usable on the FTP server.

If I create them using the UserAdd function in the menu's, everything is fine, but I can't do this at startup each time and I've read the warnings about trying to restore the various password file at startup. (I can't guarrentee that this will never have a hardisk installed).

I've tried the useradd function in the shell, but it doesn't seem to generate a valid password (this is a guess). I'm trying to supply it with a cleartext password string for the new user. When I try to open an ftp session at localhost, the password is refused.

I've also tried the adduser function in the shell. This will generate a valid user account, but will not run without user interaction (it prompts for various fields one of which is the passwd).

At this point the only thing that I can think of is to write a simple C program that calls the 'crypt' function and use that to get my non-cleartext password value.

Any thoughts?

Thanks,

   johnbo
Back to top
Profile PM 
cbagger01 Offline





Group: Members
Posts: 4264
Joined: Oct. 2003
Posted: Jan. 13 2005,17:46 QUOTE

See these threads for help:

http://damnsmalllinux.org/cgi-bin....%shadow

http://damnsmalllinux.org/cgi-bin....%shadow

http://damnsmalllinux.org/cgi-bin....%shadow
Back to top
Profile PM 
johnbo Offline





Group: Members
Posts: 3
Joined: Jan. 2005
Posted: Jan. 13 2005,19:54 QUOTE

Thanks for the pointers. It was the last one in the list that pointed me in the right direction.

What I found was that I used useradd to create the user, but not attempt to set up password. Then use chpasswd to set the password using clear text.

Code Sample
sudo bash /home/dsl/enableuser.sh
sudo useradd -g staff -d /home/cmu -p ftp -s /bin/bash -c "FTP User" cmu
sudo chpasswd < /home/dsl/ftp_password
mkdir /home/cmu
sudo chown -R cmu.staff /home/cmu
mydsl-load /cdrom/optional/ftp_files.tar.gz
/usr/sbin/betaftpd &


I had forgotten to mention that I had harvested ke4nt1's script to make the passwd type files writeable. This is what the enableuser.sh script is above.

I couldn't find much documentation for chpasswd's input format, but eventually realized that it was looking for a file with lines like user:password in it.

Thanks,

   johnbo
Back to top
Profile PM 
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: Jan. 13 2005,20:41 QUOTE

Quote
I had forgotten to mention that I had harvested ke4nt1's script to make the passwd type files writeable. This is what the enableuser.sh script is above.

I do not know of this script. But there has been the ability to addusers for ssh and ftp, thus making the appropriate files writeable, for a long time.

The script already in DSL to make the files writeable is /etc/init.d/ssh_addusers
Back to top
Profile PM WEB 
johnbo Offline





Group: Members
Posts: 3
Joined: Jan. 2005
Posted: Jan. 14 2005,05:14 QUOTE

The script that I found on the forum, is pretty much exactly what is in the ssh_adduser script. Its always amazing what you can find when you know were to look.

Thanks,

   johnbo
Back to top
Profile PM 
4 replies since Jan. 13 2005,08:08 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

 
reply to topic new topic new poll
Quick Reply: Adding a user non-interactively?

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code