HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   HOWTO-Related Questions (http://www.howtoforge.com/forums/forumdisplay.php?f=2)
-   -   Creating one "per-user" login script on Ubuntu server (http://www.howtoforge.com/forums/showthread.php?t=34597)

awe 6th May 2009 10:05

Creating one "per-user" login script on Ubuntu server
 
Hello,

Is it possible to create a bash script that Ubuntu Server will execute every time that a user logs in locally? Is it possible to set up a specific script for each user?

I explain. For the reasons that I explain on this post, I need that users listed on the LDAP tree cannot log into the server machine (please read the post for more details).

Would it be possible to create a bash script for the users that I want to lock out of the server, so that this script would log them out? I mean, a login script that would contain "logout" as the first (and probably the only) order, so that the users from the LDAP tree would pass authentication but then be kicked out more or less immediately.

How can I do that?

Thanks, and regards,

falko 7th May 2009 16:02

Why don't you give these users a shell such as /usr/sbin/nologin or /bin/false? Then they wouldn'T be able to log in via SSH.

awe 7th May 2009 17:13

Hello Falko,

I really would not want to mess something and not be able to log into my server box at all, so, because I have never changed the default shell, could you please indicatme precise instructions for changing the shell on a per-user basis? Or maybe point me somewhere on the internet where I can find those instructions? It is important to remind that the user that I created at install time should be allowed to log in, but just not the others.

I have found a number of posts and web pages talking about such a change on Ubuntu desktops, but not so for servers.

Your idea seems to me like a perfect solution.

Million thanks for your help.

falko 8th May 2009 02:24

Just edit the /etc/passwd file.


All times are GMT +2. The time now is 06:45.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.