[root@centos7 temp]# yum -y remove vi ==> yum 삭제
Loaded plugins: fastestmirror, langpacks
No Match for argument: vi
No Packages marked for removal
yum은 인터넷이 되야한다.
어댑터를 bridge로 설정
[root@centos7 temp]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO=dhcp
NAME=ens33
DEVICE=ens33
ONBOOT=yes
#IPADDR=192.168.10.100
#GATEWAY=192.168.10.254
#NETMASK=255.255.255.0
#NETWORK=192.168.10.0
#BROADCAST=192.168.10.255
#DNS1=168.126.63.1
#DNS2=8.8.8.8
"입력"
[root@centos7 temp]# systemctl restart network
[root@centos7 temp]# ifconfig ==> 주소 새로 받는거 확인. 인터넷됨
[root@centos7 temp]# ps -f | grep yum ==>다 보여줘
[root@centos7 temp]# kill -9 25920 (지울거 없으면 안지원도됨)
[root@centos7 temp]# yum -y remove vim-*
[root@centos7 temp]# yum -y install vim-* ==>다 설치해라
[root@centos7 temp]# yum -y update ==>업데이트~~
//시간좀걸림
rm -rf ./*
cat > a
간장공장
ctrl+d
cat > b
공장장
ctrl+d
cat > c
강공장장
ctrl+d
ls -l
2023.03.30 - [네트워크 수업/리눅스] - Permission.pdf 23.03.30
퍼미션 이라고 함.
읽는법을 익혀보자
- rw- r-- r-- (9자리)
d rwx(owner-이 파일의 주인) rwx(이파일의 그룹) rwx(기타사용자)
chmod g+w a ==>그룹에 쓰기권한 추가할거다 그 파일은 a파일
[root@centos7 heejae]# chmod g+w,o+w b ==>b파일에 그룹에 쓰기권한, owner에 쓰기권한
[root@centos7 heejae]# chmod g-w,o-w b ==>b파일에 그룹과 owner에 쓰기권한 빼주기
[root@centos7 heejae]# chmod g-w a
[root@centos7 heejae]# chmod ugo+x a ==>a그룹에 user group owner 세개를 전부 x(execute. 실행) 권한 주기.
세개는 다 같은 명령어이다.
[root@centos7 heejae]# who
heejae :0 2023-03-25 19:51 (:0)
heejae pts/0 2023-03-25 19:51 (:0)
[root@centos7 heejae]# w
14:33:34 up 22 min, 2 users, load average: 0.04, 0.09, 0.18
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
heejae :0 :0 토19 ?xdm? 1:42 0.22s /usr/libexec/gnome-ses
heejae pts/0 :0 토19 6.00s 0.30s 6.49s /usr/libexec/gnome-ter
[root@centos7 heejae]# users
heejae heejae
[root@centos7 temp]# usermod -g heejae root ==> 유저모드로 heejae를 root로 그룹에 넣어라.
[root@centos7 temp]# tail /etc/passwd
gdm:x:42:42::/var/lib/gdm:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
gnome-initial-setup:x:989:983::/run/gnome-initial-setup/:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
ntp:x:38:38::/etc/ntp:/sbin/nologin
tcpdump:x:72:72::/:/sbin/nologin
heejae:x:1000:1000:HEEJAE:/home/heejae:/bin/bash
user5 생성하고 파일 만들기
[root@centos7 temp]# passwd user5
user5 사용자의 비밀 번호 변경 중
새 암호:
새 암호 재입력:
passwd: 모든 인증 토큰이 성공적으로 업데이트 되었습니다.
[root@centos7 temp]# cd /home/user5
[root@centos7 user5]# ls
[root@centos7 user5]# pwd
/home/user5
[root@centos7 user5]# touch test
[root@centos7 user5]# ls -l
합계 0
-rw-r--r--. 1 root root 0 3월 30 15:01 test
[root@centos7 user5]# cat test
[root@centos7 user5]# cat >> test
cat is animal
[root@centos7 user5]# cat test
cat is animal
[root@centos7 user5]# ls
test
[root@centos7 user5]# ls -l
합계 4
-rw-r--r--. 1 root root 14 3월 30 15:02 test
[root@centos7 user5]# chown root:root test ==>이 파일의 주인이 root로 바뀌었다.
[root@centos7 user5]# ls -l
합계 4
-rw-r--r--. 1 root root 14 3월 30 15:02 test
로그아웃하고 user5로 로그인
[root@centos7 user5]# id
uid=0(root) gid=1000(heejae) groups=1000(heejae) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023[root@centos7 user5]# cat test
cat is animal
[root@centos7 user5]# cat >>test
dkdk
[user5@centos7 ~]$ id
uid=1002(user5) gid=1002(user5) groups=1002(user5) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[user5@centos7 ~]$ cat test
cat is animal
dkdk
[user5@centos7 ~]$ cat >> test
bash: test: 허가 거부
허가권 변경 방식 루메릭vs심볼릭
[root@centos7 user5]# id
uid=0(root) gid=1000(heejae) groups=1000(heejae) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[root@centos7 user5]# ls test
test
[root@centos7 user5]# ls -l test
-rw-r--r--. 1 root root 24 3월 30 15:08 test
[root@centos7 user5]# chmod o+w test
[root@centos7 user5]# exit
exit
[user5@centos7 ~]$ id
uid=1002(user5) gid=1002(user5) groups=1002(user5) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[user5@centos7 ~]$ ls -l test
-rw-r--rw-. 1 root root 24 3월 30 15:08 test
[user5@centos7 ~]$ cat >> test
available :)
user5의 그룹을 바꾸기
[user5@centos7 ~]$ su root
암호:
[root@centos7 user5]# ls -l test
-rw-r--rw-. 1 root root 37 3월 30 15:11 test
[root@centos7 user5]# usermod -g root user5 ==>user5의 그룹을 root로 바꾸겠다.
[root@centos7 user5]# su user5
[user5@centos7 ~]$ id ==>바뀐거 확인가능
uid=1002(user5) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
user5@centos7 ~]$ cat >>test
bash: test: 허가 거부
root로 가서 그룹에 쓰기 권한 주기
[user5@centos7 ~]$ su root
암호:
[root@centos7 user5]# chmod g+w test
[root@centos7 user5]# ls -l test
-rw-rw-rw-. 1 root root 37 3월 30 15:11 test
[root@centos7 user5]# su user5
[user5@centos7 ~]$ id
uid=1002(user5) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[user5@centos7 ~]$ cat >> test
oh~~~!! nice~~!!!
허가권 변경 방식 루메릭vs심볼릭
[user5@centos7 ~]$ su root
암호:
[root@centos7 user5]# cd /temp
[root@centos7 temp]# ls -l
합계 0
drwxr-xr-x. 2 root heejae 6 3월 30 15:19 a
drwxr-xr-x. 2 root heejae 6 3월 30 15:19 b
drwxr-xr-x. 2 root root 6 3월 21 15:29 c
//
만약 rw- rw- rw- 로 바꾸고 싶다면?
110 110 110 ==>6 6 6 이다.
//
[root@centos7 temp]# chmod 666 a
[root@centos7 temp]# ls -l
합계 0
drw-rw-rw-. 2 root heejae 6 3월 30 15:19 a
drwxr-xr-x. 2 root heejae 6 3월 30 15:19 b
drwxr-xr-x. 2 root root 6 3월 21 15:29 c
[root@centos7 temp]# chown user5:user1 a ==> user5은 owner, user1은 그룹
[root@centos7 temp]# ls -l
합계 0
drw-rw-rw-. 2 user5 user1 6 3월 30 15:19 a
drwxr-xr-x. 2 root heejae 6 3월 30 15:19 b
drwxr-xr-x. 2 root root 6 3월 21 15:29 c
ot@centos7 temp]# chown :root a ==>사용자는 그대로 두고 그룹만 바꿈
[root@centos7 temp]# ls -l
합계 0
drw-rw-rw-. 2 user5 root 6 3월 30 15:19 a
drwxr-xr-x. 2 root heejae 6 3월 30 15:19 b
drwxr-xr-x. 2 root root 6 3월 21 15:29 c
[root@centos7 temp]# chown user1: a ==>사용자만 바꾸기는 안됨.. 그룹도 같이 바뀜..
[root@centos7 temp]# ls -l
합계 0
drw-rw-rw-. 2 user1 user1 6 3월 30 15:19 a
drwxr-xr-x. 2 root heejae 6 3월 30 15:19 b
drwxr-xr-x. 2 root root 6 3월 21 15:29 c
허가권 루메릭 심화
파일은 666-umask
디렉터리는 777-umask
[root@centos7 temp]# umask 033
[root@centos7 temp]# rm -rf ./*
[root@centos7 temp]# mkdir test ==>directroy(777)
[root@centos7 temp]# ls -l
합계 0
drwxr--r--. 2 root heejae 6 3월 30 15:54 test
[root@centos7 temp]# touch a ==>file(666)
[root@centos7 temp]# ls -l
합계 0
-rw-r--r--. 1 root heejae 0 3월 30 15:55 a
drwxr--r--. 2 root heejae 6 3월 30 15:54 test
[root@centos7 temp]# umask 022 ==>umask 다시 되돌리기
'네트워크 수업 > 리눅스' 카테고리의 다른 글
[리눅스] 23.03.31 (0) | 2023.03.31 |
---|---|
[리눅스] 서버구축 (리눅스의 보안정책 selinux)/프로젝트관련(1) 23.03.30 (0) | 2023.03.30 |
[리눅스] RPM 23.03.29 (0) | 2023.03.29 |
[리눅스] linux package installation.pdf 23.03.29 (0) | 2023.03.29 |
[리눅스] 리눅스 압축 도구.pdf 23.03.28 (0) | 2023.03.28 |
댓글