VectorLinux
August 01, 2014, 01:29:07 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Visit our home page for VL info. To search the old message board go to http://vectorlinux.com/forum1. The first VL forum is temporarily offline until we can find a host for it. Thanks for your patience.
 
Now powered by KnowledgeDex.
   Home   Help Search Login Register  
Please support VectorLinux!
Pages: [1]
  Print  
Author Topic: How to I add an existing user to existing group?  (Read 4868 times)
rhauff
Vectorite
***
Posts: 105


« on: October 16, 2007, 10:50:52 am »

I'm trying to give my user access to the serial port, so I want to add the user to the tty group. 
I have tried (as root):
usermod -G tty roland
usermod -a -G tty roland
adduser roland tty

Now in etc/groups I see this line:
tty::5:roland

but still if I run $groups I get only:
roland sys adm disk lp floppy audio video cdrom games scanner users

Any ideas???
Logged
saulgoode
Vectorite
***
Posts: 340



« Reply #1 on: October 16, 2007, 12:41:40 pm »

It is necessary to log out and then back in for group changes to be recognized.
Logged

A complex system that works is invariably found to have evolved from a simple system that works.
rhauff
Vectorite
***
Posts: 105


« Reply #2 on: October 17, 2007, 07:29:24 am »

I forgot to mention, I had logged out after each attempt.  However, today after booting up again, it now shows tty in groups.  BUT....., now I only have:

roland tty floppy audio video cdrom

One of the commands must have screwed up my original groups!  That explains why I couldn't shutdown as regular user yesterday!  Good thing I posted my original groups on here, now at least I know which ones to add back.  After thinking about it, one of the commands worked to add my user to the tty group (after logging out & in), but the "groups" command must not have updated until I rebooted.

So, anyway, which was the proper command to add a user to a group without screwing up the existing groups?
« Last Edit: October 17, 2007, 07:45:23 am by rhauff » Logged
rbistolfi
Packager
Vectorian
****
Posts: 2277


« Reply #3 on: October 17, 2007, 08:13:48 am »

the usermod command does not append, you need to put all the groups plus the new group, i.e., if the user is a member of a group which is not listed, will be removed from the group. Should be

usermod -G roland,sys,adm,disk,lp,floppy,audio,video,cdrom,games,scanner,users,tty roland

The list of groups must be separated by a comma with no spaces.
Logged

"There is a concept which corrupts and upsets all others. I refer not to Evil, whose limited realm is that of ethics; I refer to the infinite."
Jorge Luis Borges, Avatars of the Tortoise.

--
Jumalauta!!
saulgoode
Vectorite
***
Posts: 340



« Reply #4 on: October 17, 2007, 08:22:44 am »

To add user 'rhauff' to the 'tty' group, you could use the following:

usermod -G $(groups rhauff | sed 's/ /,/g'),tty rhauff

Logged

A complex system that works is invariably found to have evolved from a simple system that works.
rhauff
Vectorite
***
Posts: 105


« Reply #5 on: October 17, 2007, 08:29:02 am »

Thanks very much.  It is working, I used usermod -G with the full list of groups.  It threw me off yesterday when I checked with the "groups" command and it didn't reflect the change.
Logged
rbistolfi
Packager
Vectorian
****
Posts: 2277


« Reply #6 on: October 17, 2007, 09:13:33 am »

To add user 'rhauff' to the 'tty' group, you could use the following:

usermod -G $(groups rhauff | sed 's/ /,/g'),tty rhauff


Very cool, thanks
Logged

"There is a concept which corrupts and upsets all others. I refer not to Evil, whose limited realm is that of ethics; I refer to the infinite."
Jorge Luis Borges, Avatars of the Tortoise.

--
Jumalauta!!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!