How to clone pi user on Raspberry Pi

Facebooktwittergoogle_plusredditpinterestlinkedintumblrmail

After setting up your Raspberry Pi you will end up with a default pi user with default password.

Obviously you will want to change your password to something else than default. Also you may want to create clone of the pi user for mainly two reasons:

1. You may want multiple users to access your Raspberry board and it’s always good idea to not share the same system account between different users. Good practice would be to create different users account and clone those from the default pi user.

2. You may eventually want to disable bult-in pi account for security reasons and use another user account to work with your Pi.

If you create a new user with simple useradd command you will end up with a very restricted account without any group membership. A good starting point would be to clone “pi” user with all its group membership.

Assuming you are logged in as “pi”, just create a file “userclone.sh”, make it executable in the pi’s home directory and run it providing two arguments – source user and destination user name. This script will create new user, it’s home directory and clone group membership from existing user.

 

Facebook Comments
Facebooktwittergoogle_plusredditpinterestlinkedintumblrmail

Leave a Reply

Your email address will not be published. Required fields are marked *