Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Exactly as the question title. I have an existing user, and I basically want to clone it for a new user. Is there a particularly easy way to do this?

Think I make a group with that user's permissions, and then add that new user to that group?

share|improve this question

2 Answers 2

On Linux (as on any POSIX system), permissions aren't tied to users. Each object (files, directories, and a few others) grants permissions to some users and some groups.

To make two users as similar as possible, make the new one a member of all the same groups as the old one. Of course, permissions that mention the user specifically (and not a group he belongs to) won't include the new one.

If you don't want to keep the old user, you can recycle the user number (UID). That way, the new user is in effect just a new name of the old one, and every privilege it had will be preserved.

share|improve this answer

If you want to make a user on the same system (not a migration from another system), use a combination of the id command and the useradd commands. id will show you the groups for the user, then you can specify the groups with useradd -G apple,banana,wheel username.

Keep in mind that you may not want the new user to have the same GID, just because you want him in the same groups.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.