View Single Post
  #6   (View Single Post)  
Old 28th June 2008
ephemera's Avatar
ephemera ephemera is offline
Knuth's homeboy
 
Join Date: Apr 2008
Posts: 537
Default

Quote:
Originally Posted by EvilMonkeySlayer View Post
I've had an idea to both make my life a bit more simpler and possibly offload the work to someone else. I have seen in the past that upon login on a console a bash script (or some kind of shell script) can run upon immediate login.

My plan is to create an interactive script that can create, modify and delete users purely from simple selections, for example this would appear upon connection:
you can create a shell script that does this and replace the login shell for the user(s) with this script in /etc/passwd.
here's an outline of what it might look like:
Code:
#!/bin/sh

trap    ':'     INT QUIT TSTP

printf 'Welcome to the bla FTP server, please make your selection:\n'
while true ; do
cat << END

1) Create user
2) Modify user
3) Delete user
4) Logout
END
        printf 'Choice? '
        read ch
        case $ch in
        1)      printf 'Enter username to create: '
                read user
                # command to create $user
                [ $? -eq 0 ] && printf "User \"$user\" was created Successfully.\n"
                ;;
        2)      # like above
                ;;
        3)      # like above
                ;;
        4)      exit
                ;;
        esac
done
note: this is only for the convinience of parametric users and not security.
Reply With Quote