Adding a linux user/group and modifying the primary group of the user.
Steps:[root@localhost ~]# groupadd bigdata
[root@localhost ~]# grep -i bigdata /etc/group
bigdata:x:1001:
[root@localhost ~]#
[root@localhost ~]# useradd -m hadoop
bigdata:x:1001:
[root@localhost ~]#
[root@localhost ~]# useradd -m hadoop
[root@localhost ~]# id hadoop
uid=1001(hadoop) gid=1002(hadoop) groups=1002(hadoop)
uid=1001(hadoop) gid=1002(hadoop) groups=1002(hadoop)
[root@localhost ~]# ls -altr /home/hadoop
total 12
-rw-r--r--. 1 hadoop hadoop 231 Mar 31 2020 .bashrc
-rw-r--r--. 1 hadoop hadoop 193 Mar 31 2020 .bash_profile
-rw-r--r--. 1 hadoop hadoop 18 Mar 31 2020 .bash_logout
drwxr-xr-x. 4 root root 35 Mar 1 02:00 ..
drwx------. 2 hadoop hadoop 62 Mar 1 02:00 .
total 12
-rw-r--r--. 1 hadoop hadoop 231 Mar 31 2020 .bashrc
-rw-r--r--. 1 hadoop hadoop 193 Mar 31 2020 .bash_profile
-rw-r--r--. 1 hadoop hadoop 18 Mar 31 2020 .bash_logout
drwxr-xr-x. 4 root root 35 Mar 1 02:00 ..
drwx------. 2 hadoop hadoop 62 Mar 1 02:00 .
[root@localhost ~]# usermod -g bigdata hadoop
[root@localhost ~]# ls -altr /home/hadoop
total 12
-rw-r--r--. 1 hadoop bigdata 231 Mar 31 2020 .bashrc
-rw-r--r--. 1 hadoop bigdata 193 Mar 31 2020 .bash_profile
-rw-r--r--. 1 hadoop bigdata 18 Mar 31 2020 .bash_logout
drwxr-xr-x. 4 root root 35 Mar 1 02:00 ..
drwx------. 2 hadoop bigdata 62 Mar 1 02:00 .
total 12
-rw-r--r--. 1 hadoop bigdata 231 Mar 31 2020 .bashrc
-rw-r--r--. 1 hadoop bigdata 193 Mar 31 2020 .bash_profile
-rw-r--r--. 1 hadoop bigdata 18 Mar 31 2020 .bash_logout
drwxr-xr-x. 4 root root 35 Mar 1 02:00 ..
drwx------. 2 hadoop bigdata 62 Mar 1 02:00 .
[root@localhost ~]#
[root@localhost ~]# passwd hadoop
Changing password for user hadoop.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]#
Changing password for user hadoop.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]#
<<<<<<<<<<< set a strong password
Now logged in as hadoop.
Last failed login: Mon Mar 1 02:06:41 EST 2021 from gateway on ssh:notty
Last login: Mon Mar 1 02:06:20 2021
[hadoop@localhost ~]$
[hadoop@localhost ~]$ ls -altr
total 16
-rw-r--r--. 1 hadoop bigdata 231 Mar 31 2020 .bashrc
-rw-r--r--. 1 hadoop bigdata 193 Mar 31 2020 .bash_profile
-rw-r--r--. 1 hadoop bigdata 18 Mar 31 2020 .bash_logout
drwxr-xr-x. 4 root root 35 Mar 1 02:00 ..
-rw-------. 1 hadoop bigdata 5 Mar 1 02:06 .bash_history
drwx------. 2 hadoop bigdata 83 Mar 1 02:06 .
[hadoop@localhost ~]$
total 16
-rw-r--r--. 1 hadoop bigdata 231 Mar 31 2020 .bashrc
-rw-r--r--. 1 hadoop bigdata 193 Mar 31 2020 .bash_profile
-rw-r--r--. 1 hadoop bigdata 18 Mar 31 2020 .bash_logout
drwxr-xr-x. 4 root root 35 Mar 1 02:00 ..
-rw-------. 1 hadoop bigdata 5 Mar 1 02:06 .bash_history
drwx------. 2 hadoop bigdata 83 Mar 1 02:06 .
[hadoop@localhost ~]$
This closes this blog.Thanks
No comments:
Post a Comment