Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
HI All,
I am trying to learn shell scripting from a book and all I am doing is following few instruction from the book.
Now this is what I am doing.
I am trying to add a user using the useradd command so I run the following
at command prompt
root@S8500C_9>useradd ajit.
The first time when I add this user I was successful.Later I deleted this suer using the userdel -r ajit command.Now when again I am trying to add this user it gives me following error.
useradd: group ajit exists - if you want to add this user to that group, use -g.
Now when I try using the -g option with the useradd command it gives we all the set off options avaiable to use along with the useradd command but doesnt create the ajit use
Can anyone tell me how can I create the same user after deleting it.
It tells you what the problem is-- "useradd: group ajit exists", remove the group or tinker with the options of your useradd. -g requires a group to be specified... ajit in this case. When in doubt look up the option for the program by typing: man programname (eg: man useradd) and check that you're using each option correctly.
Then run the add again, it's telling you what the problem is-- "useradd: group ajit exists", remove the group or tinker with the options of your useradd
Code:
useradd ajit -g ajit
Thanks rweaver.Now what if I have to add some other user to a group named ajit?
The only reason I don't typically suggest people use usermod is because its default behavior is destructive. If a new user has setup say 20 people in a specific group and forgets the -a it will replace the group with just the user(s) being added. It's not really an issue if you have good backups (although a bit annoying with tape backups), but the most common problem I see in any operating system is a lack of backups.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.