Results 1 to 4 of 4
Is it possible in Linux to assign a new user who log in for the first time to two different groups? The situation is: Im a computer trainee at the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 02-07-2012 #1
- Join Date
- Feb 2012
Assign new users to two groups?
Is it possible in Linux to assign a new user who log in for the first time to two different groups?
The situation is: Im a computer trainee at the geological institution in Lund Sweden, I have set up ubuntu as a Macintosh Time Machine backup server. The server is set up to accept both local users and LDAP users, and when I log in from the Mac with a user in LDAP but who's not in the local users list, ubuntu creates a new home directory at /home/<username>, with the help of PAM mk_homedir.
The problem is : I have made a separate folder /Backup, where I mount the Time Machine disk. I have created a new group called tmusers, and I want only the members of this group to be able to access and write to the /Backup folder
My supervisor wants the process of creating a user to be as transparent as possible (i.e. it saves him time to do other things). The best situation would be not needing to do anything on the server at all.
So I need the users to be member of their own group AND "tmusers" . Furthermore the adding of a specific user to "tmusers" should be done only the first time a user logs in, wether its a local user or a LDAP user.
Does anyone know how to solve whole/parts of this problem? Any help greatly appreciated.
- 02-07-2012 #2
A user can belong to as many groups as you like. Just use the usermod command to add the user to the new group (usermod -aG groupname username)."I'm just a little old lady; don't try to dazzle me with jargon!"
- 02-07-2012 #3
How is the user login being created in the first place? If it were me I would just add the additional groups when the user login is created, such as `useradd -m -G backup testuser`; if you need the additional group for every single user you add, then you could create an alias with `alias useradd='useradd -m -G backup'` - this way you can simply type `useradd testuser`.
bash-4.0# groups testuser testuser : testuser backup
# useradd defaults file GROUP=100 HOME=/home INACTIVE=-1 EXPIRE= SHELL=/bin/bash SKEL=/etc/skel CREATE_MAIL_SPOOL=no
- 02-08-2012 #4
- Join Date
- Feb 2012
Hi & thankyou for your answers to this thread! My appologies, I
think I havent been clear enough about what the problem is really
about. The problem is :
I need LDAP users to automatically be assigned to the group tmusers
when they login for the first time from a mac.
It goes like:
1. A user wants to use Time Machine to backup his data. He/she has not done it before.
2. He/she enters the username and passwd and logs in
for the first on the ubuntu server with an LDAP account.
3. The ubuntu server creates a new homefolder for the user automatically
4. The new user should be assigned to a specific group, tmusers, in addition
to the original group.
Is there a way to do the last step automatically so that I dont have to touch
the ubuntu server at all ( i.e. not usermod etc.) ?
I doŽnt think it is possible myself.....any ideas?