Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > HOWTO-Related Questions

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 6th May 2009, 09:05
awe awe is offline
Junior Member
 
Join Date: May 2009
Location: Tossa de Mar (Girona) Spain
Posts: 17
Thanks: 0
Thanked 3 Times in 3 Posts
Default 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,
Reply With Quote
Sponsored Links
  #2  
Old 7th May 2009, 15:02
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,735 Times in 2,571 Posts
Default

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.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 7th May 2009, 16:13
awe awe is offline
Junior Member
 
Join Date: May 2009
Location: Tossa de Mar (Girona) Spain
Posts: 17
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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.
Reply With Quote
  #4  
Old 8th May 2009, 01:24
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,735 Times in 2,571 Posts
 
Default

Just edit the /etc/passwd file.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SunRay On Ubuntu, Partially Running :-) badgerbox76 Server Operation 7 7th December 2008 05:24
FTP cannot open remote folder!?! andysm849 Server Operation 23 16th October 2008 23:34
Need help with setting up a Ubuntu Server KyO757 Server Operation 1 10th April 2008 17:52
Rejecting outbound mail tristanlee85 General 11 20th May 2007 17:04
Problems with Postfix Mysql Courier PatrickAdrichem Installation/Configuration 3 13th April 2007 15:44


All times are GMT +2. The time now is 00:51.


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