## mkdir option ##
root@ubuntu:/home/nojeans# mkdir --help
Usage: mkdir [OPTION]... DIRECTORY...
Create the DIRECTORY(ies), if they do not already exist.
Mandatory arguments to long options are mandatory for short options too.
-m, --mode=MODE set file mode (as in chmod), not a=rwx - umask
-p, --parents no error if existing, make parent directories as needed
-v, --verbose print a message for each created directory
-Z set SELinux security context of each created directory
to the default type
--context[=CTX] like -Z, or if CTX is specified then set the SELinux
or SMACK security context to CTX
--help display this help and exit
--version output version information and exit
## 권한 -> drwxr-xr-x ##
nojeans@ubuntu:~$ mkdir -m 755 test
nojeans@ubuntu:~$ ls -al
total 40
drwxr-xr-x 5 nojeans nojeans 4096 Mar 25 08:03 .
drwxr-xr-x 3 root root 4096 Mar 21 05:01 ..
-rw------- 1 nojeans nojeans 30 Mar 21 05:41 .bash_history
-rw-r--r-- 1 nojeans nojeans 220 Feb 25 2020 .bash_logout
-rw-r--r-- 1 nojeans nojeans 3771 Feb 25 2020 .bashrc
drwx------ 2 nojeans nojeans 4096 Mar 21 05:01 .cache
-rw-r--r-- 1 nojeans nojeans 807 Feb 25 2020 .profile
drwx------ 2 nojeans nojeans 4096 Mar 21 05:01 .ssh
-rw-r--r-- 1 nojeans nojeans 0 Mar 21 05:01 .sudo_as_admin_successful
drwxr-xr-x 2 nojeans nojeans 4096 Mar 25 08:03 test
-rw------- 1 nojeans nojeans 52 Mar 25 07:51 .Xauthority
## 권한 -> drwxrwxrwx #
nojeans@ubuntu:~$ mkdir -m 777 test02
nojeans@ubuntu:~$ ls
test test02
nojeans@ubuntu:~$ ls -al
total 44
drwxr-xr-x 6 nojeans nojeans 4096 Mar 25 08:03 .
drwxr-xr-x 3 root root 4096 Mar 21 05:01 ..
-rw------- 1 nojeans nojeans 30 Mar 21 05:41 .bash_history
-rw-r--r-- 1 nojeans nojeans 220 Feb 25 2020 .bash_logout
-rw-r--r-- 1 nojeans nojeans 3771 Feb 25 2020 .bashrc
drwx------ 2 nojeans nojeans 4096 Mar 21 05:01 .cache
-rw-r--r-- 1 nojeans nojeans 807 Feb 25 2020 .profile
drwx------ 2 nojeans nojeans 4096 Mar 21 05:01 .ssh
-rw-r--r-- 1 nojeans nojeans 0 Mar 21 05:01 .sudo_as_admin_successful
drwxr-xr-x 2 nojeans nojeans 4096 Mar 25 08:03 test
drwxrwxrwx 2 nojeans nojeans 4096 Mar 25 08:03 test02
-rw------- 1 nojeans nojeans 52 Mar 25 07:51 .Xauthority
nojeans@ubuntu:~$ mkdir -p dir1/dir2/dir3
## 권한 필요하면 "sudo" 이용 ##
nojeans@ubuntu:~$ rm -r dir1
rm: descend into write-protected directory 'dir1'? yes
rm: descend into write-protected directory 'dir1/dir2'? yes
rm: remove write-protected directory 'dir1/dir2/dir3'? yes
rm: cannot remove 'dir1/dir2/dir3': Permission denied
nojeans@ubuntu:~$
nojeans@ubuntu:~$
nojeans@ubuntu:~$ sudo rm -r dir1
nojeans@ubuntu:~$ mkdir -v check
mkdir: created directory 'check' ## 이런 방식으로 알림 ##
nojeans@ubuntu:~$ ls
check
## selinux 설치되지 않은 환경 ##
nojeans@ubuntu:~$ sestatus -v | head -1 # selinux version 확인하는 명령어
Command 'sestatus' not found, but can be installed with:
sudo apt install policycoreutils
[참고 자료] https://leevisual.tistory.com/66