Do you run the bftpd, wooble, stream fuse, and other scripts that start daemons on your OSD? Sometimes you don't want them to automatically start when the OSD boots. Are you tired of having to login to your OSD, change to the directory where your source programs are to run the various start scripts?
Here is a fun trick from Unix that makes it possible to run programs from the telnet login prompt quickly. For example:
$
telnet 192.168.100.102Trying 192.168.100.102...
Connected to 192.168.100.102.
Escape character is '^]'.
neuros login:
startftp
FTPd started...
Connection closed by foreign host.
--------------
Here are the simple steps:
1) Create a fictitious application account as a user with the shell pointing to your script
(Note: Paths defined in the script cannot not be RELATIVE!)2) Delete the password from the password file and change the UID to ?0?.
3) Login with the application account ID.
I?m sure some people are saying, ?
What? REMOVE the password and make the user account have root permissions!?. Since the script being executed is the login account shell, when the script finishes, exits, fails, or stops, the telnet session is closed. As for using root?s UID ?0?, only when absolutely necessary! Unfortunately, root level access is needed to start and run some of the daemons. So you can see this is safe as long as you don?t spawn a shell within the script that is being executed.
--------------
Here is a sample of the steps to do this trick with ?bftpd? (
http://www.limesg.com/osd/ftpserver):
1) Create the application account:
$
adduser -H -D -h /tmp -g "Start bftpd" -s /mnt/tmpfs/mount_USB/src/run-ftpserver.sh -G users startftpNote: -h just needs to be an area that can be read/write by the account, /tmp works good. Your ?-s? is the script to execute.2) Edit /etc/passwd (remove password field / change UID to 0).
Change the line from:
startftp
:!:500:100:Start bftpd:/tmp:/mnt/tmpfs/mount_USB/src/run-ftpserver.sh
Change the line to:
startftp
::0:100:Start bftpd:/tmp:/mnt/tmpfs/mount_USB/src/run-ftpserver.sh
3) Login to OSD:
$ telnet 192.168.100.102
Trying 192.168.100.102...
Connected to 192.168.100.102.
Escape character is '^]'.
neuros login: startftp
FTPd started...
Connection closed by foreign host.
Login to the OSD normally and check that bftpd was started:
/ $ ps -ef | grep bftpd
1868 root 1660 SW
/media/USB/src/bftpd -c
/media/USB/src/bftpd.conf -
--------------
Remember up above I told you that all scripts need to have the
?Relative? paths defined. The BFTPD start script run-ftpserver.sh was modified from:
#!/bin/sh
./bftpd -c ./bftpd.conf -D &
?and the
relative paths were changed to:
#!/bin/sh
/media/USB/zsrc/bftpd -c /media/USB/zsrc/bftpd.conf -D &
echo
echo "FTPd started..."
I hope this helps, have fun!
-wk