Add existing user into an existing group


 
Thread Tools Search this Thread
Operating Systems Solaris Add existing user into an existing group
# 1  
Old 03-05-2009
Add existing user into an existing group

Pre: no gpasswd/adduser

there is just usermod can be used, also there is no -a option for usermod.

How should I add a user into a group?
a2156z
# 2  
Old 03-05-2009
"usermod -G group user"
This User Gave Thanks to jlliagre For This Post:
# 3  
Old 03-05-2009
edit the /etc/group file and you will be good to go.
# 4  
Old 03-05-2009
Yes, vi is what I would use. Here is something that should work if scripting is a requirement. I misunderstood the question in my first answer.
Code:
usermod -G $(groups user| sed -e 's/.*: *//' -e 's/  */,/g'),group user

# 5  
Old 03-05-2009
Quote:
Originally Posted by jlliagre
Yes, vi is what I would use. Here is something that should work if scripting is a requirement. I misunderstood the question in my first answer.
Code:
usermod -G $(groups user| sed -e 's/.*: *//' -e 's/  */,/g'),group user

THAT took me 17 minutes to decipher. Now I know why I love VEE EYE Smilie

But, at work I usually use a combination of cut and tr to achieve the same; switching to this from now on. Thanks!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

Create a new user from using existing users profile

Hello, Just wanting to know if it is possible. Also I am new to command line. I am running 5.1b, if that matters. Thanks in advance (10 Replies)
Discussion started by: bcha
10 Replies

2. AIX

Adding existing VG to powerHA Resource group

Hello. I am Running AIX 6.1 and PowerHA 6.1 I have an active/active cluster (Prod/Dev) cluster. Each side will failover to the other. I have on my prod side an active volume group with a file system. The VG is imported on both nodes and active (varried on, file system mounted) on the prod... (3 Replies)
Discussion started by: mhenryj
3 Replies

3. UNIX for Dummies Questions & Answers

Appending lines from an existing list to each line in another existing list

Evening all ! I would like to ask your expertise on how to accomplish the following ; I have 2 lists, and would like each line from list2 to be appended to each line in list1, resulting in list3 ; List1; alpha beta charlie List2; one two three (4 Replies)
Discussion started by: TAPE
4 Replies

4. UNIX for Dummies Questions & Answers

create new group/delete existing group

Hi, please let me know the commands to create new group/delete existing group in unix and assigning users to newly created group. Thank you in advance. (2 Replies)
Discussion started by: kancherla.sree
2 Replies

5. UNIX for Dummies Questions & Answers

Setting up existing Directories using facls to recursively add an individual user

I've been working with Solaris/Linux for about 4 months now. Let me explain the scenario. There will be two users involved. The owner (curOwner) and the new user (newUser). The server in question is a Solaris 10 box. So curOwner runs an application that is constantly writing logs to lets say.... (2 Replies)
Discussion started by: amadont12
2 Replies

6. Shell Programming and Scripting

Giving existing user access on ftp

Hi all, I have a project on going that combines two different departments. I cannot give detais on this project, I´m sure everybody understands that, but I would like your help on giving me pointers on how to give an existing user access to ftp, without the need to give him full access. So here... (0 Replies)
Discussion started by: Alexis Duarte
0 Replies

7. Shell Programming and Scripting

insert pipes for existing and non-existing records

I have a source file like this, L4058S462 34329094 F51010141TK1070000483L4058S462 34329094 0232384840 381892 182 5690 L4058S462 34329094 F51020141FIRST CLEARING, LLC A/C 3432-9094 L4058S462 34329094 F51030141JOHAN HOLMQVIST ... (1 Reply)
Discussion started by: saravanamr
1 Replies

8. Shell Programming and Scripting

folder existing and file existing

I want to look into a folder to see if there are any folders within it. If there are, I need to check inside each folder to see if it contains a .pdf file So If /myserver/myfolder/ contains a folder AND that folder conatins a .pdf file do X Else do Z I may have multiple folders and... (4 Replies)
Discussion started by: crowman
4 Replies

9. UNIX for Dummies Questions & Answers

usermod -G and Group id login replacing existing groups

Hi all usermod -G Group_id login it is replacing the existiong Secoundry groups and is adding the only group speced in usermod command how can we retain the existing secoundry groups and add a user to a new group (6 Replies)
Discussion started by: pbsrinivas
6 Replies

10. UNIX for Dummies Questions & Answers

Assigning existing users to a secondary group

Hi!!, I am on HP UX -11. I have created a new group and want to assign some the users to this group without changing their existing group ( The new group is the secondary group for them) Any ideas how to do it?? SAM doesnt seem to be working.. Any way of doing it from command line?? ... (1 Reply)
Discussion started by: jyotipg
1 Replies
Login or Register to Ask a Question