3 Basic Commands and Simple Shell Scripts Once you have your first Red Hat Enterprise Linux rhel


[root@rhel-instance ]# umask 0077



Download 1.85 Mb.
View original pdf
Page67/67
Date26.02.2024
Size1.85 Mb.
#63678
1   ...   59   60   61   62   63   64   65   66   67
Pablo Iranzo Gómez, Pedro Ibáñez Requena, Miguel Pérez Colino, Scott McCarty - Red Hat Enterprise Linux 9 Administration-Packt Publishing (2022) -chap 3 82 - 180
[root@rhel-instance
]# umask 0077

[root@rhel-instance
]# touch file4.txt

[root@rhel-instance
]# ls -l file4.txt

-rw-------. 1 root root 0 Mar 11 22:35 file4.txt
Let’s reestablish umask in our session to the defaults to continue practicing:
[root@rhel-instance
]# umask 0022

Now, we may find ourselves with the need to create a directory fora specific user or group or to change the owner of a file. To be able to change the ownership of a file or directory, the chown or chgrp tools are used. Let’s see how it works. Let’s move to /var/tmp and create the folders for finance and accounting:
[root@rhel-instance
]# cd /var/tmp/

[root@rhel-instance tmp]# mkdir finance
[root@rhel-instance tmp]# mkdir accounting
[root@rhel-instance tmp]# ls -l
total 0
drwxr-xr-x. 2 root root 6 Mar 11 22:35 accounting
drwxr-xr-x. 2 root root 6 Mar 11 22:35 finance
Now, let’s create the groups for finance and accounting:
[root@rhel-instance tmp]# groupadd finance
[root@rhel-instance tmp]# groupadd accounting
groupadd: group 'accounting' already exists
In this example, the accounting group was already created. Let’s change the group for each directory with chgrp:
[root@rhel-instance tmp]# chgrp accounting accounting/
[root@rhel-instance tmp]# chgrp finance finance/
[root@rhel-instance tmp]# ls -l
total 0
drwxr-xr-x. 2 root accounting 6 Mar 11 22:35 accounting
drwxr-xr-x. 2 root finance 6 Mar 11 22:35 finance

Download 1.85 Mb.

Share with your friends:
1   ...   59   60   61   62   63   64   65   66   67




The database is protected by copyright ©ininet.org 2024
send message

    Main page