![]() ![]() Read: How to manage permissions in Linux – guide for beginners F- User account locking : -L option You also need to kill all user owned processes using : To kill the above process, 3900, owned by user admin_net2 run the command : This means that all processes owned by user admin_net2 should be killed. You may get the following message if you try to change the login name of a currently active user, for instance: Now a simple check of the changed name will yield the same attributes as the old one (same groups, same UID) : ![]() This will make the test user net2guy disappear since we changed it : Let us change the login name net2_admin to net2_adm for example: This option allows to modify the user login name. To verify this, run the following command as usual :Į – User login name modification : -l option This can be done using the -G option as follows : adding a new group named ‘net2_admin’ to user net2guy : The test user we have been playing with can have other groups. You may be interested to read: How to disable user accounts and enhance password authentication in Ubuntu ? D – Extending the group set of a User: -G option Where you can see that the original group has been modified. In order to check this was accounted for, run the command below : The current primary group for the test user net2guy can be checked as follows: This option allows to change a user account primary group. We can now check that this has indeed changed :ĭ – User primary group modification : -g option Using the -e option, we change this value as follows: The expiry status of our test user ‘net2guy is Oct 2 2019. The current user account expiry date can be checked using chage command applied to our test user : In order to set an expiry date for a user account, this option can be used. Read: C – User account expiry date setting : -e option Now we can check that it has indeed been modified : In order to modify this and set it to a new directory, say /home/net2_admin, we have to use the -d option as follows: In the snapshot above, you can clearly see the home directory of the user net2guy, namely /home/net2guy/. Vi /etc/passwd (or you can use your preferred editor) In order to check that this has worked, you can view the file /etc/passwd : Sudo usermod -c “information for net2guy” net2guy We can for instance add an information message to user ‘net2guy’ as follows : Read: The Sudoers File in Ubuntu A- Adding extra information to user account : -c optionĪs mentioned above, this option adds an information text about the user account. -u = allows to assign new UID for the user account ( between 0 and 999).-s = will yield a new login shell for the new user account.-p = allows everyone to see the new password in /etc/shadow (not recommended).-m = allows to have the contents of the home directory moved to the new directory.-l = We will use it to change the login name from net2_admin to net2_adm.-a = appends the user to already defined supplemental groups.Read: How to use sudo without having to enter a password in Ubuntu -G = allows us to add a new list of supplementary groups.-g = used to modify the primary group for a user.-e = enables us to set the account expiry date.-d = allows us to alter the home folder of a user account.-c = allows us to provide a comment field for the user account./etc/fs – configuration of the Shadow password suite.Īs shown in the snapshot above (usermod man), here are the options to use with the usermod command :./etc/gshadow – information about the secure group account./etc/group – information about the group account./etc/shadow – information about the secure account./etc/passwd – information about the user account.When the ‘usermod‘ command is executed, the files below will be used and also affected. Read: How to create a Sudo user on Ubuntu The most basic syntax of the command usermod is the following : You need to make sure also that the user to be changed is not currently executing any process when the usermod command is being invoked to change the name, the UID or the home folder of the user. Note that only the root(super user) can invoke the usermod command. In order to execute usermod command, we need to have an existing user account. The usermod command modifies or alters any attributes of a previously created user account via command line.In some situations, an administrator would need to change the existing attributes of an already created user like the login name, the home folder of the user, the password expiry date.This is where usermod command comes in.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |