LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

Reply
 
Search this Thread
Old 08-26-2013, 12:40 AM   #1
AbidDhanaiser
Member
 
Registered: May 2013
Location: Faisalabad, Pakistan
Posts: 72

Rep: Reputation: Disabled
How to Modify User ID , Group Id


Hi all , how to modify or change USEr /Group id in Linux.
and how to kill a user after specific period of time , for example i want that Dhanaiser should not login for ever on system after August 30 2013 ,,,
 
Old 08-26-2013, 01:34 AM   #2
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,722

Rep: Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261
you can use the usermod command
see manpage: usermod -u, usermod -g for changing uid/gid and usermod -e 1 for locking
 
Old 08-26-2013, 01:56 AM   #3
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 516

Rep: Reputation: 58
thats it you got the answer above.

just a bit to add specifying new gid should keep in mind that group should exist so as for uid the uid should be unique unless -o is specified and between 0-999 .

for more read man usermod.

EDIT:
Quote:
how to kill a user after specific period of time ,
Timeouts can be set by setting the TMOUT variable in .bashrc.

Quote:
for example i want that Dhanaiser should not login for ever on system after August 30 2013 ,,,
This is different than above, you should first decide what you actually want, timeout for a session or no login for a user.

Last edited by SAbhi; 08-26-2013 at 02:06 AM.
 
Old 08-26-2013, 02:25 AM   #4
AbidDhanaiser
Member
 
Registered: May 2013
Location: Faisalabad, Pakistan
Posts: 72

Original Poster
Rep: Reputation: Disabled
i want that user should not allow to log in after 31 august 2013
 
Old 08-26-2013, 02:29 AM   #5
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,722

Rep: Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261
see usermod -e and man page. Much quicker than waiting for an answer ...
 
Old 08-26-2013, 02:49 AM   #6
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 516

Rep: Reputation: 58
Quote:
i want that user should not allow to log in after 31 august 2013
see below:

Code:
usermod -e [date in YYYY-MM-DD format]
 
Old 08-27-2013, 01:15 AM   #7
AbidDhanaiser
Member
 
Registered: May 2013
Location: Faisalabad, Pakistan
Posts: 72

Original Poster
Rep: Reputation: Disabled
SAbhi , is there any way to erase user after some specific time .
 
Old 08-27-2013, 01:23 AM   #8
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,722

Rep: Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261Reputation: 1261
http://linux.die.net/man/8/userdel
 
Old 08-27-2013, 01:33 AM   #9
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 516

Rep: Reputation: 58
Yes there is but not a single command AFAIK. you have to schedule the task to remove the user after a specific time, a utility like cron or at can be used with
Code:
userdel -f -r [username]
but i wont recommend that because before removing a user you should know:
1. whether there is any process which is owned by the user and currently running.
2. whether there any file or dir created and owned by the user.

Although these can be handled afterwards too but it is always good to have caution.

Last edited by SAbhi; 08-27-2013 at 01:36 AM.
 
Old 08-27-2013, 06:49 AM   #10
bpn4it
LQ Newbie
 
Registered: Mar 2011
Location: Ahmedabad
Distribution: Centos
Posts: 3

Rep: Reputation: 1
you can also use chage command to user login for specific day.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User is a Part of a Group But Group Details Do Not Show the User devUnix Linux - Server 6 08-08-2013 07:02 AM
[SOLVED] why chown user:group wildcard in path /home/user/.*/* will modify all /home owner cociugcristina Linux - Server 11 05-07-2013 04:16 AM
Modify group(%admin) with username in sudoers file smilemukul Linux - Newbie 5 06-08-2012 02:39 AM
modify owner and group names when copying on linux bash w3developing Linux - Newbie 5 08-14-2009 09:32 PM
unable to modify ownership or group as root bubblehead Linux - Newbie 0 11-24-2003 09:15 PM


All times are GMT -5. The time now is 05:16 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration