Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
That's it, finally after a great struggle found the right way.
After following you tip i'm able to reach my requirment, but in the shell script (YourScriptHere.sh)
i'm calling a expect script. But while trying to do that the session quits. Do i want to add any
entries to run the expect script ?
Thanks a lot for the solution, waiting for your next suggestion.
I'm still not sure about what you're trying to do, but I will tell you some things anyway...
Catch the signals that may interrupt/stop the script. Run "help trap".
You may test it this way:
trap "echo Hey!" INT
^C
kill -INT $$
The signals you need to be aware of are:
SIGHUP - Hangup
SIGINT - ^C
SIGQUIT - ^\
and possibly:
SIGTSTP - ^Z
To test your script, see your key combinations with "stty -a".
The bash manpage states that:
The shell exits by default upon receipt of a SIGHUP. Before exiting, an interactive shell resends the SIGHUP to all jobs, running or stopped.
So you may use this signal to kill off any processes left running by the user:
trap "pkill -9 -U username" HUP
If you want to restrict shell access, then be warned that some programs may spawn a shell...
If you care about security, don't use telnet (specially if this account will use a shell). Use ssh instead.
With your suggestion my process goes on very well, But a small query that
If i'm entering the script in file "/etc/passwd" it reaches my requirement but
at the same time the user is unable to login through FTP.
Is there any way to use the same user for both Telnet and FTP.
Originally posted by bharaniks
Is there any way to use the same user for both Telnet and FTP.
Yes, because they read the same files (/etc/passwd, shadow, etc.). The problem now is that the ftp daemon reads /etc/shells and refuses connection if the user's shell isn't a valid shell (ie, isn't listed in /etc/shells). Comment the line in /etc/pam.d/ftpd to be something like this:
Code:
#auth required pam_shells.so
The '#' above is a comment...
Note that ssh can replace telnet and ftp and it's more secure
(I couldn't resist...)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.