{"id":224,"date":"2015-07-06T11:05:47","date_gmt":"2015-07-06T11:05:47","guid":{"rendered":"http:\/\/www.howtolearnlinux.com\/?p=224"},"modified":"2024-02-12T09:22:55","modified_gmt":"2024-02-12T09:22:55","slug":"redhat-linux-user-administration","status":"publish","type":"post","link":"http:\/\/shijuvarghese.com\/?p=224","title":{"rendered":"Redhat Linux User Administration (RHEL 4)"},"content":{"rendered":"<p><span style=\"font-family: verdana; font-size: small;\">User ID = uid. The uid of root is 0.<br \/>\nUID from 1 to 499 is reserved for system services such as the user apache, nagios, etc<\/span><\/p>\n<p>The first user created by root will always have a UID 500 in older versions of RHEL and UID 1000 in newer versions.<\/p>\n<p>Maximum users = 60,000 by default. This could be increased.<\/p>\n<p>When root is initially created \/root will be created.<br \/>\nWhen user1 is created \/home\/user1 will be created.<\/p>\n<p>\/etc\/login.dfs contains all the info about users.<\/p>\n<p>By default when a user is created, a group will also be created for him. This will be his one and only primary group. He could be part of multiple secondary groups.<\/p>\n<p>The file \/etc\/passwd stores user information but not the actual password<\/p>\n<p>Root:x:0:0:0:root:\/root:\/bin\/bash<br \/>\n(username: presence of password: uid: gid: personal info: home dir: shell)<\/p>\n<p>The &#8216;x&#8217; in the password file indicates that password is present which might be in &#8220;shadow&#8221; concept or &#8220;umd 5&#8221; concept.<\/p>\n<p>The file \/etc\/shadow is the one that holds the encrypted password.<\/p>\n<p>The files \/etc\/passwd- and \/etc\/shadow- are backup files which usually gets updated within a certain interval of time.<\/p>\n<p><b># finger root :<\/b> This will display user info of the user &#8216;root&#8217;.<\/p>\n<p><b># chfn root :<\/b> To change the user info of the user root.<\/p>\n<p><b># useradd user_1 :<\/b> To create a user names &#8216;user_1&#8217;. The default &#8216;uid&#8217;, &#8216;gid&#8217;, home directory and shell will be created.<\/p>\n<p><b># useradd -d \/home\/new user_2 :<\/b> Add a new user with a specific home directory<\/p>\n<p><b># useradd -g g1 user_1 :<\/b> Add a new user with primary group &#8216;g1&#8217;. The group &#8216;g1&#8217; should be a existing one.<\/p>\n<p><b># useradd -G gg1 user_1 :<\/b> Add a user with secondary group &#8216;gg1&#8217;.<\/p>\n<p><b># useradd -s \/bin\/ksh user_1 :<\/b> Add a user and assign the default shell as \/bin\/ksh<\/p>\n<p><b># userdel\u00a0user_2 :\u00a0<\/b>Delete used_2, but his home folder will be still present<\/p>\n<p><b># userdel -r user_2\u00a0:\u00a0<\/b>Delete used_2,\u00a0and his home folder<\/p>\n<p><b># usermod -g group2 user_1 :<\/b> Change the primary group of &#8216;user_1&#8217;<\/p>\n<p><b># usermod -l superuser root :<\/b> Change the username of root to superuser<\/p>\n<p><b># usermod -d \/new -m user_1 :<\/b> Change the home directory of &#8216;user_1&#8217; to \/new and move all the files to the new directory.<\/p>\n<p><b># useradd -p shiju user_1 :<\/b> Create a new user with &#8216;shiju&#8217; as the password. This password will not be stored in the file in encrypted format.<\/p>\n<p><b># passwd -d user_1 :<\/b> Disable the password for &#8216;user_1&#8217;. The user &#8216;user_1&#8217; will not have any password nor will be able to create a password.<\/p>\n<p><b># passwd -l user_1 :<\/b> Lock the account of &#8216;user_1&#8217;<\/p>\n<p><b># passwd -u user_1 :<\/b> Unlock the account<\/p>\n<p><b># chage -l user_1 :<\/b> List the aging information of password, account expiration details, etc.<\/p>\n<p><b># chage user_1 :<\/b> Change the aging information of users&#8217;s password.<\/p>\n<p><b># userdel user_1 :<\/b> Delete the user<\/p>\n<p><b># gpasswd -M user_1, user_2 g1 :<\/b> Adding multiple users to group common<\/p>\n<p><b># gpasswd g1 :<\/b> Assigning a password for the group g1. The reason for assigning password for a group is to prevent a user to change his default group and add to g1.<\/p>\n<p><b># grpuncov :<\/b> This will copy the contents of group shadow password to \/etc\/group. Here the password in \/etc\/group will be encrypted.<\/p>\n<p><b># grpcon :<\/b> This will bring back the shadow file and thus will remove the password displayed in \/et c\/group<\/p>\n<p><b># chown user1 \/etc\/myfile :<\/b> Change the ownership of the file &#8216;myfile&#8217;<\/p>\n<p><b># chgrp mygroup \/etc\/myfile :<\/b> Change the group ownership of the file &#8216;myfile&#8217;<\/p>\n<p><b># chown user4.group4 \/etc\/myfile :<\/b> Change the user and group ownership of the file &#8216;\/etc\/myfile&#8217;.<\/p>\n<p><b># chown -R user5 mydir :<\/b> Change the ownership of all the files and directories in the main directory &#8216;mydir&#8217;<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>User ID = uid. The uid of root is 0. UID from 1 to 499 is reserved for system services such as the user apache, <a class=\"mh-excerpt-more\" href=\"http:\/\/shijuvarghese.com\/?p=224\" title=\"Redhat Linux User Administration (RHEL 4)\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":256,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,31],"tags":[],"class_list":["post-224","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-rhel-4"],"_links":{"self":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/224","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=224"}],"version-history":[{"count":5,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/224\/revisions"}],"predecessor-version":[{"id":1000,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/224\/revisions\/1000"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/media\/256"}],"wp:attachment":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=224"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=224"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=224"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}