Nc7 복습장

holy one·2023년 4월 26일
0

Study

목록 보기
2/11

복습

  • 4.26
j15@ace:~/d3$ pwd
/home/j15/d3
j15@ace:~/d3$ nl ~/.bash_aliases		- 전날 제작한 il 함수 코드
     1  function il()
     2  {
     3          echo -e "\n 좋아요 좋아요 좋아요 \ㅜ"
     4  }



j15@ace:~/d3$ gcc b.c		- 			- 컴파일 작업
j15@ace:~/d3$ ll
합계 44
drwxrwxr-x 2 j15 j15  4096  4월 26 10:02 ./
drwxr-x--- 8 j15 j15  4096  4월 26 09:58 ../
-rw------- 1 j15 j15 12288  4월 26 10:02 .b.c.swp
-rw-rw-r-- 1 j15 j15    49  4월 26 09:54 3-2.c
-rwxrwxr-x 1 j15 j15 15960  4월 26 10:02 a.out*		-컴파일 이름 지정 안하면 이렇게 저장
-rw-rw-r-- 1 j15 j15    92  4월 26 10:01 b.c


j15@ace:~/d3$ ./a.out				- echo $PATH에서 확인

 c언어가 짱인가?...?

j15@ace:~/d3$ PATH=$PATH:.
j15@ace:~/d3$ a.out					- 경로 지정없이 파일 명으로 실행하기

 c언어가 짱인가?...?
 
 
j15@ace:~/d3$ ll
합계 32
drwxrwxr-x 2 j15 j15  4096  4월 26 10:04 ./
drwxr-x--- 8 j15 j15  4096  4월 26 10:04 ../
-rw-rw-r-- 1 j15 j15    49  4월 26 09:54 3-2.c
-rwxrwxr-x 1 j15 j15 15960  4월 26 10:02 a.out*
-rw-rw-r-- 1 j15 j15    92  4월 26 10:01 b.c
j15@ace:~/d3$ gcc -o bb b.c
j15@ace:~/d3$
j15@ace:~/d3$ ll
합계 48
drwxrwxr-x 2 j15 j15  4096  4월 26 10:04 ./
drwxr-x--- 8 j15 j15  4096  4월 26 10:04 ../
-rw-rw-r-- 1 j15 j15    49  4월 26 09:54 3-2.c
-rwxrwxr-x 1 j15 j15 15960  4월 26 10:02 a.out*
-rw-rw-r-- 1 j15 j15    92  4월 26 10:01 b.c
-rwxrwxr-x 1 j15 j15 15960  4월 26 10:04 bb*
j15@ace:~/d3$ gcc b.c -o b
j15@ace:~/d3$ ll
합계 64
drwxrwxr-x 2 j15 j15  4096  4월 26 10:04 ./
drwxr-x--- 8 j15 j15  4096  4월 26 10:04 ../
-rw-rw-r-- 1 j15 j15    49  4월 26 09:54 3-2.c
-rwxrwxr-x 1 j15 j15 15960  4월 26 10:02 a.out*
-rwxrwxr-x 1 j15 j15 15960  4월 26 10:04 b*
-rw-rw-r-- 1 j15 j15    92  4월 26 10:01 b.c
-rwxrwxr-x 1 j15 j15 15960  4월 26 10:04 bb*
 

4.27


enableF
=
 [root@nc7 ~]# compgen -b | paste - - - - -
.       :       [       alias   bg
bind    break   builtin caller  cd
command compgen complete        compopt continue
declare dirs    disown  echo    enable
eval    exec    exit    export  false
fc      fg      getopts hash    help
history jobs    kill    let     local
logout  mapfile popd    printf  pushd
pwd     read    readarray       readonly        return
set     shift   shopt   source  suspend
test    times   trap    true    type
typeset ulimit  umask   unalias unset
wait



echo $SHELL
echo ~
df -h : disk free
du /etc : /etc 용량 확인
[root@nc7 ~]# du /etc/
21M     /etc/
[root@nc7 ~]# du /etc/ -sh
21M     /etc/



[root@nc7 ~]# du ~sh ~blue/
du: cannot access '~sh': No such file or directory
16K     /home/blue/


dnf list | more


환경변수



[root@nc7 ~]# useradd white
[root@nc7 ~]# passwd white
Changing password for user white.
New password:
BAD PASSWORD: The password is a palindrome
Retype new password:
passwd: all authentication tokens updated successfully.

[root@nc7 ~]# ls /home/	- 가입 확인
blue  green  red  white
[root@nc7 ~]#
[root@nc7 ~]# nl /etc/passwd | tail -5
    24  pipewire:x:989:989:PipeWire System Daemon:/var/run/pipewire:/sbin/nologin
    25  flatpak:x:988:988:User for flatpak system helper:/:/sbin/nologin
    26  mysql:x:27:27:MySQL Server:/var/lib/mysql:/sbin/nologin
    27  blue:x:1000:1000::/home/blue:/bin/bash
    28  white:x:1001:1001::/home/white:/bin/bash

dnf -y install : y: 설치 여부 확인

[root@nc7 ~]# di wget
Last metadata expiration check: 0:04:44 ago on Thu Apr 27 10:01:15 2023.
Dependencies resolved.
================================================================================================================
 Package               Architecture            Version                         Repository                  Size
================================================================================================================
Installing:
 wget                  x86_64                  1.21.1-7.el9                    appstream                  769 k

Transaction Summary
================================================================================================================
Install  1 Package

Total download size: 769 k
Installed size: 3.1 M
Downloading Packages:
wget-1.21.1-7.el9.x86_64.rpm                                                    856 kB/s | 769 kB     00:00
----------------------------------------------------------------------------------------------------------------
Total                                                                           525 kB/s | 769 kB     00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                        1/1
  Installing       : wget-1.21.1-7.el9.x86_64                                                               1/1
  Running scriptlet: wget-1.21.1-7.el9.x86_64                                                               1/1
  Verifying        : wget-1.21.1-7.el9.x86_64                                                               1/1

Installed:
  wget-1.21.1-7.el9.x86_64

Complete!
[root@nc7 ~]#
[root@nc7 ~]# di wget
Last metadata expiration check: 0:04:52 ago on Thu Apr 27 10:01:15 2023.
Package wget-1.21.1-7.el9.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!



[root@nc7 ~]# pstree		- 프로세스를 트리 형식으로 확인~
systemd─┬─NetworkManager───2*[{NetworkManager}]
        ├─anacron
        ├─auditd───{auditd}
        ├─chronyd
        ├─crond
        ├─dbus-broker-lau───dbus-broker
        ├─firewalld───{firewalld}
        ├─irqbalance───{irqbalance}
        ├─login───bash
        ├─mysqld───38*[{mysqld}]
        ├─polkitd───5*[{polkitd}]
        ├─rsyslogd───2*[{rsyslogd}]
        ├─sshd─┬─sshd───sshd───bash───pstree
        │      └─sshd───sshd───bash
        ├─systemd───(sd-pam)
        ├─systemd-journal
        ├─systemd-logind
        └─systemd-udevd
[root@nc7 ~]# tree
-bash: tree: command not found
[root@nc7 ~]# di tree
Last metadata expiration check: 0:05:51 ago on Thu Apr 27 10:01:15 2023.
Dependencies resolved.
================================================================================================================
 Package                Architecture             Version                         Repository                Size
================================================================================================================
Installing:
 tree                   x86_64                   1.8.0-10.el9                    baseos                    55 k

Transaction Summary
================================================================================================================
Install  1 Package

Total download size: 55 k
Installed size: 113 k
Downloading Packages:
tree-1.8.0-10.el9.x86_64.rpm                                                    1.1 MB/s |  55 kB     00:00
----------------------------------------------------------------------------------------------------------------
Total                                                                            85 kB/s |  55 kB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                        1/1
  Installing       : tree-1.8.0-10.el9.x86_64                                                               1/1
  Running scriptlet: tree-1.8.0-10.el9.x86_64                                                               1/1
  Verifying        : tree-1.8.0-10.el9.x86_64                                                               1/1

Installed:
  tree-1.8.0-10.el9.x86_64

Complete!


[root@nc7 ~]# dnf list --installed | grep tree
ostree-libs.x86_64                        2022.5-1.el9                     @appstream
tree.x86_64                               1.8.0-10.el9                     @baseos


[root@nc7 ~]# tree
.
├── anaconda-ks.cfg
├── k2
└── pslist

0 directories, 3 files

[root@nc7 ~]# whatis tree
tree (1)             - list contents of directories in a tree-like format.


[root@nc7 ~]# dnf -y remove tree		- tree 삭제
Dependencies resolved.
================================================================================================================
 Package                Architecture             Version                        Repository                 Size
================================================================================================================
Removing:
 tree                   x86_64                   1.8.0-10.el9                   @baseos                   113 k

Transaction Summary
================================================================================================================
Remove  1 Package

Freed space: 113 k
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                        1/1
  Erasing          : tree-1.8.0-10.el9.x86_64                                                               1/1
  Running scriptlet: tree-1.8.0-10.el9.x86_64                                                               1/1
  Verifying        : tree-1.8.0-10.el9.x86_64                                                               1/1

Removed:
  tree-1.8.0-10.el9.x86_64

Complete!
[root@nc7 ~]# tree /
-bash: /usr/bin/tree: No such file or directory


[root@nc7 ~]# dnf info tree		-tree 명령어 정보 확인
Last metadata expiration check: 0:10:29 ago on Thu Apr 27 10:01:15 2023.
Installed Packages
Name         : tree
Version      : 1.8.0
Release      : 10.el9
Architecture : x86_64
Size         : 113 k
Source       : tree-pkg-1.8.0-10.el9.src.rpm
Repository   : @System
From repo    : baseos
Summary      : File system tree viewer
URL          : http://mama.indstate.edu/users/ice/tree/
License      : GPLv2+ and LGPLv2+
Description  : The tree utility recursively displays the contents of directories in a
             : tree-like format.  Tree is basically a UNIX port of the DOS tree
             : utility.


[root@nc7 ~]# yum info tree			- dnf와 똑같음
Last metadata expiration check: 0:14:10 ago on Thu Apr 27 10:01:15 2023.
Installed Packages
Name         : tree
Version      : 1.8.0
Release      : 10.el9
Architecture : x86_64
Size         : 113 k
Source       : tree-pkg-1.8.0-10.el9.src.rpm
Repository   : @System
From repo    : baseos
Summary      : File system tree viewer
URL          : http://mama.indstate.edu/users/ice/tree/
License      : GPLv2+ and LGPLv2+
Description  : The tree utility recursively displays the contents of directories in a
             : tree-like format.  Tree is basically a UNIX port of the DOS tree
             : utility.

[root@nc7 ~]# dnf -3 info tree		- yum과 같음
Last metadata expiration check: 0:14:33 ago on Thu Apr 27 10:01:15 2023.
Installed Packages
Name         : tree
Version      : 1.8.0
Release      : 10.el9
Architecture : x86_64
Size         : 113 k
Source       : tree-pkg-1.8.0-10.el9.src.rpm
Repository   : @System
From repo    : baseos
Summary      : File system tree viewer
URL          : http://mama.indstate.edu/users/ice/tree/
License      : GPLv2+ and LGPLv2+
Description  : The tree utility recursively displays the contents of directories in a
             : tree-like format.  Tree is basically a UNIX port of the DOS tree
             : utility.

[root@nc7 ~]# whereis yum
yum: /usr/bin/yum /etc/yum /usr/share/man/man8/yum.8.gz
[root@nc7 ~]# which yum
/usr/bin/yum
[root@nc7 ~]# whatis yum
yum (8)              - redirecting to DNF Command Reference
[root@nc7 ~]# ll /usr/bin/yum
lrwxrwxrwx. 1 root root 5 Nov 15 18:28 /usr/bin/yum -> dnf-3
[root@nc7 ~]# which dnf
/usr/bin/dnf
[root@nc7 ~]# ll /usr/bin/dnf
lrwxrwxrwx. 1 root root 5 Nov 15 18:28 /usr/bin/dnf -> dnf-3		=결과는 같다



RockyLInux Package
rpm	: 과거 관리 Tool (현 사용 x)
yum,dnf  : dnf-3의 symbolic link임을 확인

설치

di [설치 패키지]

dnf install [설치 패키지]

업데이트
dnf update

조회
dnf list --installed
dnf -3 info
yum info
dq [프로그램]
ps -ef | grep [프로그램] = 프로세스 확인


삭제
dnf remove

정보보기
whereis
whatis
which


실습)

di httpd 
dnf 

[root@nc7 ~]# systemctl stop firewalld

127.0.0.1


자주 등장하는 에러
[root@nc7 /]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
= 프로그램 시작을 해야함!

[root@nc7 /]# systemctl start mysqld = 시작 명령어
			     └> d : daemon


socket - pipe
s	p	

[root@nc7 /]# dnf info mysql-server
Last metadata expiration check: 0:57:09 ago on Thu Apr 27 10:01:15 2023.
Installed Packages
Name         : mysql-server
Version      : 8.0.30
Release      : 3.el9_0
Architecture : x86_64
Size         : 106 M
Source       : mysql-8.0.30-3.el9_0.src.rpm
Repository   : @System
From repo    : appstream
Summary      : The MySQL server and related files
URL          : http://www.mysql.com
License      : GPLv2 with exceptions and LGPLv2 and BSD
Description  : MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
             : client/server implementation consisting of a server daemon (mysqld)
             : and many different client programs and libraries. This package contains
             : the MySQL server and some accompanying files and directories.

[root@nc7 /]# systemctl status mysqld
● mysqld.service - MySQL 8.0 database server
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
     Active: active (running) since Thu 2023-04-27 10:55:57 KST; 3min 15s ago
    Process: 2482 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
    Process: 2504 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS)
   Main PID: 2538 (mysqld)
     Status: "Server is operational"
      Tasks: 38 (limit: 12294)
     Memory: 367.6M
        CPU: 1.674s
     CGroup: /system.slice/mysqld.service
             └─2538 /usr/libexec/mysqld --basedir=/usr

Apr 27 10:55:56 nc7.linux.kr systemd[1]: Starting MySQL 8.0 database server...
Apr 27 10:55:57 nc7.linux.kr systemd[1]: Started MySQL 8.0 database server.


[root@nc7 /]# systemctl stop mysqld			- 정지 명령어

[root@nc7 /]# systemctl status mysqld		- 에러 출력
○ mysqld.service - MySQL 8.0 database server
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
     Active: inactive (dead)

Apr 27 10:55:14 nc7.linux.kr systemd[1]: Stopping MySQL 8.0 database server...
Apr 27 10:55:14 nc7.linux.kr systemd[1]: mysqld.service: Deactivated successfully.
Apr 27 10:55:14 nc7.linux.kr systemd[1]: Stopped MySQL 8.0 database server.
Apr 27 10:55:14 nc7.linux.kr systemd[1]: mysqld.service: Consumed 36.047s CPU time.
Apr 27 10:55:56 nc7.linux.kr systemd[1]: Starting MySQL 8.0 database server...
Apr 27 10:55:57 nc7.linux.kr systemd[1]: Started MySQL 8.0 database server.
Apr 27 10:59:58 nc7.linux.kr systemd[1]: Stopping MySQL 8.0 database server...
Apr 27 10:59:59 nc7.linux.kr systemd[1]: mysqld.service: Deactivated successfully.
Apr 27 10:59:59 nc7.linux.kr systemd[1]: Stopped MySQL 8.0 database server.
Apr 27 10:59:59 nc7.linux.kr systemd[1]: mysqld.service: Consumed 1.983s CPU time.

  • 4.27
---rocky 로 마운트 하는 법

[root@nc7 ~]# mount -r /dev/cdrom /media/			-t : 파일 시스템 유형을 지정

[root@nc7 ~]# df /media/
Filesystem      Size  Used Avail Use% Mounted on
/dev/sr0         52M   52M     0 100% /media		- 정상적인 mount 실행완료

[root@nc7 ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 4.0M     0  4.0M   0% /dev
tmpfs                    982M     0  982M   0% /dev/shm
tmpfs                    393M  5.5M  388M   2% /run
/dev/mapper/rl_nc7-root   12G  2.6G  9.5G  21% /
/dev/sda1               1014M  184M  831M  19% /boot
/dev/mapper/rl_nc7-home  5.0G   68M  5.0G   2% /home
tmpfs                    197M  4.0K  197M   1% /run/user/0
/dev/mapper/rl_nc7-data   10G  125M  9.9G   2% /data
/dev/sr0                  52M   52M     0 100% /media	- ★	

[root@nc7 ~]# cd /media/

[root@nc7 /media]# ls
AUTORUN.INF  VBoxDarwinAdditions.pkg            VBoxWindowsAdditions-amd64.exe  cert
NT3x         VBoxDarwinAdditionsUninstall.tool  VBoxWindowsAdditions-x86.exe    runasroot.sh
OS2          VBoxLinuxAdditions.run             VBoxWindowsAdditions.exe        windows11-bypass.reg
TRANS.TBL    VBoxSolarisAdditions.pkg           autorun.sh

[root@nc7 /media]# ./VBoxLinuxAdditions.run		- 실행파일 가동
Verifying archive integrity...  100%   MD5 checksums are OK. All good.
Uncompressing VirtualBox 7.0.8 Guest Additions for Linux  100%
bzip2 not found★.  Please install: bzip2 tar; and try again.		- bzip2 설치 필요하다는 의존성 문제 발견

[root@nc7 /media]# di bzip2			- 설치 	


[root@nc7 /media]# ./VBoxLinuxAdditions.run
Verifying archive integrity...  100%   MD5 checksums are OK. All good.
Uncompressing VirtualBox 7.0.8 Guest Additions for Linux  100%
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
/opt/VBoxGuestAdditions-7.0.8/bin/VBoxClient: error while loading shared libraries: libXt.so.6: cannot open shared object file: No such file or directory
/opt/VBoxGuestAdditions-7.0.8/bin/VBoxClient: error while loading shared libraries: libXt.so.6: cannot open shared object file: No such file or directory
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Setting up modules
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel
modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Kernel headers not found for target kernel
5.14.0-162.6.1.el9_1.x86_64. Please install them and execute
  /sbin/rcvboxadd setup
VirtualBox Guest Additions: reloading kernel modules and services
cannot verify if kernel modules and services were reloaded
The log file /var/log/vboxadd-setup.log may contain further information.


[root@nc7 /media]# df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 4.0M     0  4.0M   0% /dev
tmpfs                    982M     0  982M   0% /dev/shm
tmpfs                    393M  5.5M  388M   2% /run
/dev/mapper/rl_nc7-root   12G  2.6G  9.5G  22% /
/dev/sda1               1014M  184M  831M  19% /boot
/dev/mapper/rl_nc7-home  5.0G   68M  5.0G   2% /home
tmpfs                    197M  4.0K  197M   1% /run/user/0
/dev/mapper/rl_nc7-data   10G  125M  9.9G   2% /data
/dev/sr0                  52M   52M     0 100% /media	

리눅스에서 mount 명령어 옵션

-t: 파일 시스템 유형을 지정합니다. 예를 들어, -t ext4는 ext4 파일 시스템을 사용합니다.

-o: 추가 옵션을 지정합니다. 이 옵션을 사용하여 특정 파일 시스템에 대한 추가 옵션을 설정할 수 있습니다. 예를 들어, -o ro는 읽기 전용으로 파일 시스템을 마운트합니다.

noexec: 이 옵션을 사용하면 마운트된 파일 시스템에서 실행 파일을 실행하지 못하도록 할 수 있습니다.

nodev: 이 옵션을 사용하면 마운트된 파일 시스템에서 디바이스 파일을 생성하지 못하도록 할 수 있습니다.

nosuid: 이 옵션을 사용하면 마운트된 파일 시스템에서 SUID와 SGID 비트를 무시할 수 있습니다.

remount: 이 옵션을 사용하면 마운트된 파일 시스템을 다시 마운트할 수 있습니다. 이것은 파일 시스템의 옵션을 변경할 때 유용합니다.


  • 4.28 (mount 작업, 디스크 분할)
[root@nc7 ~]# mount -r /dev/cdrom /media/	- virtualbox 저장소에서 iso 이미지 파일 연결 후 실행

[root@nc7 ~]# df /media/
Filesystem      Size  Used Avail Use% Mounted on
/dev/sr0         52M   52M     0 100% /media

[root@nc7 ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 4.0M     0  4.0M   0% /dev
tmpfs                    982M     0  982M   0% /dev/shm
tmpfs                    393M  5.5M  388M   2% /run
/dev/mapper/rl_nc7-root   12G  2.6G  9.5G  21% /
/dev/sda1               1014M  184M  831M  19% /boot
/dev/mapper/rl_nc7-home  5.0G   68M  5.0G   2% /home
tmpfs                    197M  4.0K  197M   1% /run/user/0
/dev/mapper/rl_nc7-data   10G  125M  9.9G   2% /data
/dev/sr0                  52M   52M     0 100% /media	- 자동 마운트

[root@nc7 ~]# cd /media/
[root@nc7 /media]# ls
AUTORUN.INF  VBoxDarwinAdditions.pkg            VBoxWindowsAdditions-amd64.exe  cert
NT3x         VBoxDarwinAdditionsUninstall.tool  VBoxWindowsAdditions-x86.exe    runasroot.sh
OS2          VBoxLinuxAdditions.run             VBoxWindowsAdditions.exe        windows11-bypass.reg
TRANS.TBL    VBoxSolarisAdditions.pkg           autorun.sh

[root@nc7 /media]# ./VBoxLinuxAdditions.run
Verifying archive integrity...  100%   MD5 checksums are OK. All good.
Uncompressing VirtualBox 7.0.8 Guest Additions for Linux  100%
bzip2 not found.  Please install: bzip2 tar; and try again.
-  bzip2 의존성 에러 출력 

[root@nc7 /media]# di bzip2			- 설치
Last metadata expiration check: 2:43:43 ago on Thu Apr 27 13:04:53 2023.
Dependencies resolved.
================================================================================================================
 Package                 Architecture             Version                        Repository                Size
================================================================================================================
Installing:
 bzip2                   x86_64                   1.0.8-8.el9                    baseos                    52 k

Transaction Summary
================================================================================================================
Install  1 Package

Total download size: 52 k
Installed size: 94 k
Downloading Packages:
bzip2-1.0.8-8.el9.x86_64.rpm                                                    581 kB/s |  52 kB     00:00
----------------------------------------------------------------------------------------------------------------
Total                                                                            70 kB/s |  52 kB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                        1/1
  Installing       : bzip2-1.0.8-8.el9.x86_64                                                               1/1
  Running scriptlet: bzip2-1.0.8-8.el9.x86_64                                                               1/1
  Verifying        : bzip2-1.0.8-8.el9.x86_64                                                               1/1

Installed:
  bzip2-1.0.8-8.el9.x86_64

Complete!


[root@nc7 /media]# ./VBoxLinuxAdditions.run		- 다시 실행
Verifying archive integrity...  100%   MD5 checksums are OK. All good.
Uncompressing VirtualBox 7.0.8 Guest Additions for Linux  100%
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
/opt/VBoxGuestAdditions-7.0.8/bin/VBoxClient: error while loading shared libraries: libXt.so.6: cannot open shared object file: No such file or directory
/opt/VBoxGuestAdditions-7.0.8/bin/VBoxClient: error while loading shared libraries: libXt.so.6: cannot open shared object file: No such file or directory
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Setting up modules
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel
modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Kernel headers not found for target kernel
5.14.0-162.6.1.el9_1.x86_64. Please install them and execute
  /sbin/rcvboxadd setup
VirtualBox Guest Additions: reloading kernel modules and services
cannot verify if kernel modules and services were reloaded
The log file /var/log/vboxadd-setup.log may contain further information.


[root@nc7 /media]# df -h		
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 4.0M     0  4.0M   0% /dev
tmpfs                    982M     0  982M   0% /dev/shm
tmpfs                    393M  5.5M  388M   2% /run
/dev/mapper/rl_nc7-root   12G  2.6G  9.5G  22% /
/dev/sda1               1014M  184M  831M  19% /boot
/dev/mapper/rl_nc7-home  5.0G   68M  5.0G   2% /home
tmpfs                    197M  4.0K  197M   1% /run/user/0
/dev/mapper/rl_nc7-data   10G  125M  9.9G   2% /data
/dev/sr0                  52M   52M     0 100% /media		

[root@nc7 ~]# fdisk /dev/sda

Welcome to fdisk (util-linux 2.37.4).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

This disk is currently in use - repartitioning is probably a bad idea.
It's recommended to umount all file systems, and swapoff all swap
partitions on this disk.


Command (m for help): m

Help:

  DOS (MBR)
   a   toggle a bootable flag
   b   edit nested BSD disklabel
   c   toggle the dos compatibility flag

  Generic
   d   delete a partition
   F   list free unpartitioned space
   l   list known partition types
   n   add a new partition
   p   print the partition table
   t   change a partition type
   v   verify the partition table
   i   print information about a partition

  Misc
   m   print this menu
   u   change display/entry units
   x   extra functionality (experts only)

  Script
   I   load disk layout from sfdisk script file
   O   dump disk layout to sfdisk script file

  Save & Exit
   w   write table to disk and exit
   q   quit without saving changes

  Create a new label
   g   create a new empty GPT partition table
   G   create a new empty SGI (IRIX) partition table
   o   create a new empty DOS partition table
   s   create a new empty Sun partition table


Command (m for help): l

00 Empty            24 NEC DOS          81 Minix / old Lin  bf Solaris
01 FAT12            27 Hidden NTFS Win  82 Linux swap / So  c1 DRDOS/sec (FAT-
02 XENIX root       39 Plan 9           83 Linux            c4 DRDOS/sec (FAT-
03 XENIX usr        3c PartitionMagic   84 OS/2 hidden or   c6 DRDOS/sec (FAT-
04 FAT16 <32M       40 Venix 80286      85 Linux extended   c7 Syrinx
05 Extended         41 PPC PReP Boot    86 NTFS volume set  da Non-FS data
06 FAT16            42 SFS              87 NTFS volume set  db CP/M / CTOS / .
07 HPFS/NTFS/exFAT  4d QNX4.x           88 Linux plaintext  de Dell Utility
08 AIX              4e QNX4.x 2nd part  8e Linux LVM        df BootIt
09 AIX bootable     4f QNX4.x 3rd part  93 Amoeba           e1 DOS access
0a OS/2 Boot Manag  50 OnTrack DM       94 Amoeba BBT       e3 DOS R/O
0b W95 FAT32        51 OnTrack DM6 Aux  9f BSD/OS           e4 SpeedStor
0c W95 FAT32 (LBA)  52 CP/M             a0 IBM Thinkpad hi  ea Linux extended
0e W95 FAT16 (LBA)  53 OnTrack DM6 Aux  a5 FreeBSD          eb BeOS fs
0f W95 Ext'd (LBA)  54 OnTrackDM6       a6 OpenBSD          ee GPT
10 OPUS             55 EZ-Drive         a7 NeXTSTEP         ef EFI (FAT-12/16/
11 Hidden FAT12     56 Golden Bow       a8 Darwin UFS       f0 Linux/PA-RISC b
12 Compaq diagnost  5c Priam Edisk      a9 NetBSD           f1 SpeedStor
14 Hidden FAT16 <3  61 SpeedStor        ab Darwin boot      f4 SpeedStor
16 Hidden FAT16     63 GNU HURD or Sys  af HFS / HFS+       f2 DOS secondary
17 Hidden HPFS/NTF  64 Novell Netware   b7 BSDI fs          fb VMware VMFS
18 AST SmartSleep   65 Novell Netware   b8 BSDI swap        fc VMware VMKCORE
1b Hidden W95 FAT3  70 DiskSecure Mult  bb Boot Wizard hid  fd Linux raid auto
1c Hidden W95 FAT3  75 PC/IX            bc Acronis FAT32 L  fe LANstep
1e Hidden W95 FAT1  80 Old Minix        be Solaris boot     ff BBT

Aliases:
   linux          - 83
   swap           - 82
   extended       - 05
   uefi           - EF
   raid           - FD
   lvm            - 8E
   linuxex        - 85

Command (m for help): p

Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
Disk model: VBOX HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf458a236

Device     Boot   Start      End  Sectors Size Id Type
/dev/sda1  *       2048  2099199  2097152   1G 83 Linux
/dev/sda2       2099200 62914559 60815360  29G 8e Linux LVM

Command (m for help): d
Partition number (1,2, default 2):

Partition 2 has been deleted.

Command (m for help): p
Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
Disk model: VBOX HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf458a236

Device     Boot Start     End Sectors Size Id Type
/dev/sda1  *     2048 2099199 2097152   1G 83 Linux

Command (m for help): d
Selected partition 1
Partition 1 has been deleted.

Command (m for help): p
Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
Disk model: VBOX HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf458a236

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-62914559, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-62914559, default 62914559): +1G

Created a new partition 1 of type 'Linux' and of size 1 GiB.
Partition #1 contains a xfs signature.

Do you want to remove the signature? [Y]es/[N]o: y

The signature will be removed by a write command.

Command (m for help): p
Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
Disk model: VBOX HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf458a236

Device     Boot Start     End Sectors Size Id Type
/dev/sda1        2048 2099199 2097152   1G 83 Linux

Filesystem/RAID signature on partition 1 will be wiped.

Command (m for help): d				-삭제
Partition number (1-5, default 5): 4

Partition 4 has been deleted.

Command (m for help): p

Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
Disk model: VBOX HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf458a236

Device     Boot   Start      End  Sectors Size Id Type
/dev/sda1          2048  2099199  2097152   1G 83 Linux
/dev/sda2       2099200  6293503  4194304   2G 83 Linux
/dev/sda3       6293504 16779263 10485760   5G 83 Linux

Filesystem/RAID signature on partition 1 will be wiped.
Filesystem/RAID signature on partition 2 will be wiped.


Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-62914559, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-62914559, default 62914559): +1G

Created a new partition 1 of type 'Linux' and of size 1 GiB.
Partition #1 contains a xfs signature.

Do you want to remove the signature? [Y]es/[N]o: p
Do you want to remove the signature? [Y]es/[N]o: n

Command (m for help): p

Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
Disk model: VBOX HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf458a236

Device     Boot Start     End Sectors Size Id Type
/dev/sda1        2048 2099199 2097152   1G 83 Linux

Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p):

Using default response p.
Partition number (2-4, default 2): 2
First sector (2099200-62914559, default 2099200):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2099200-62914559, default 62914559): +2G

Created a new partition 2 of type 'Linux' and of size 2 GiB.
Partition #2 contains a LVM2_member signature.

Do you want to remove the signature? [Y]es/[N]o: y

The signature will be removed by a write command.

Command (m for help): p
Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
Disk model: VBOX HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf458a236

Device     Boot   Start     End Sectors Size Id Type
/dev/sda1          2048 2099199 2097152   1G 83 Linux
/dev/sda2       2099200 6293503 4194304   2G 83 Linux

Filesystem/RAID signature on partition 2 will be wiped.

Command (m for help): n
Partition type
   p   primary (2 primary, 0 extended, 2 free)
   e   extended (container for logical partitions)
Select (default p):

Using default response p.
Partition number (3,4, default 3): 3
First sector (6293504-62914559, default 6293504):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (6293504-62914559, default 62914559): +10G

Created a new partition 3 of type 'Linux' and of size 10 GiB.

Command (m for help): p
Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
Disk model: VBOX HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf458a236

Device     Boot   Start      End  Sectors Size Id Type
/dev/sda1          2048  2099199  2097152   1G 83 Linux
/dev/sda2       2099200  6293503  4194304   2G 83 Linux
/dev/sda3       6293504 27265023 20971520  10G 83 Linux

Filesystem/RAID signature on partition 2 will be wiped.

Command (m for help): n
Partition type
   p   primary (3 primary, 0 extended, 1 free)
   e   extended (container for logical partitions)
Select (default e): p

Selected partition 4
First sector (27265024-62914559, default 27265024):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (27265024-62914559, default 62914559):

Created a new partition 4 of type 'Linux' and of size 17 GiB.

Command (m for help): p
Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
Disk model: VBOX HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf458a236

Device     Boot    Start      End  Sectors Size Id Type
/dev/sda1           2048  2099199  2097152   1G 83 Linux
/dev/sda2        2099200  6293503  4194304   2G 83 Linux
/dev/sda3        6293504 27265023 20971520  10G 83 Linux
/dev/sda4       27265024 62914559 35649536  17G 83 Linux

Filesystem/RAID signature on partition 2 will be wiped.

Command (m for help): n
To create more partitions, first replace a primary with an extended partition.

Command (m for help): d
Partition number (1-4, default 4): 1

Partition 1 has been deleted.

Command (m for help): n
Partition type
   p   primary (3 primary, 0 extended, 1 free)
   e   extended (container for logical partitions)
Select (default e): p

Selected partition 1
First sector (2048-2099199, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-2099199, default 2099199):

Created a new partition 1 of type 'Linux' and of size 1 GiB.
Partition #1 contains a xfs signature.

Do you want to remove the signature? [Y]es/[N]o: n

Command (m for help): d
Partition number (1-4, default 4): 4

Partition 4 has been deleted.

Command (m for help): n
Partition type
   p   primary (3 primary, 0 extended, 1 free)
   e   extended (container for logical partitions)
Select (default e): e

Selected partition 4
First sector (27265024-62914559, default 27265024):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (27265024-62914559, default 62914559):

Created a new partition 4 of type 'Extended' and of size 17 GiB.

Command (m for help): p
Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
Disk model: VBOX HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf458a236

Device     Boot    Start      End  Sectors Size Id Type
/dev/sda1           2048  2099199  2097152   1G 83 Linux
/dev/sda2        2099200  6293503  4194304   2G 83 Linux
/dev/sda3        6293504 27265023 20971520  10G 83 Linux
/dev/sda4       27265024 62914559 35649536  17G  5 Extended

Filesystem/RAID signature on partition 2 will be wiped.

Command (m for help): n
All primary partitions are in use.
Adding logical partition 5
First sector (27267072-62914559, default 27267072):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (27267072-62914559, default 62914559): +2G

Created a new partition 5 of type 'Linux' and of size 2 GiB.
Partition #5 contains a xfs signature.

Do you want to remove the signature? [Y]es/[N]o: y

The signature will be removed by a write command.

Command (m for help): p
Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
Disk model: VBOX HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf458a236

Device     Boot    Start      End  Sectors Size Id Type
/dev/sda1           2048  2099199  2097152   1G 83 Linux
/dev/sda2        2099200  6293503  4194304   2G 83 Linux
/dev/sda3        6293504 27265023 20971520  10G 83 Linux
/dev/sda4       27265024 62914559 35649536  17G  5 Extended
/dev/sda5       27267072 31461375  4194304   2G 83 Linux

Filesystem/RAID signature on partition 2 will be wiped.
Filesystem/RAID signature on partition 5 will be wiped.

Command (m for help): n
All primary partitions are in use.
Adding logical partition 6
First sector (31463424-62914559, default 31463424):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (31463424-62914559, default 62914559): +2G

Created a new partition 6 of type 'Linux' and of size 2 GiB.

Command (m for help): n
All primary partitions are in use.
Adding logical partition 7
First sector (35659776-62914559, default 35659776):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (35659776-62914559, default 62914559): +2G

Created a new partition 7 of type 'Linux' and of size 2 GiB.

Command (m for help): p
Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
Disk model: VBOX HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf458a236

Device     Boot    Start      End  Sectors Size Id Type
/dev/sda1           2048  2099199  2097152   1G 83 Linux
/dev/sda2        2099200  6293503  4194304   2G 83 Linux
/dev/sda3        6293504 27265023 20971520  10G 83 Linux
/dev/sda4       27265024 62914559 35649536  17G  5 Extended
/dev/sda5       27267072 31461375  4194304   2G 83 Linux
/dev/sda6       31463424 35657727  4194304   2G 83 Linux
/dev/sda7       35659776 39854079  4194304   2G 83 Linux

Filesystem/RAID signature on partition 2 will be wiped.
Filesystem/RAID signature on partition 5 will be wiped.

Command (m for help): n
All primary partitions are in use.
Adding logical partition 8
First sector (39856128-62914559, default 39856128):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (39856128-62914559, default 62914559): +13G
Value out of range.
Last sector, +/-sectors or +/-size{K,M,G,T,P} (39856128-62914559, default 62914559): +12G
Value out of range.
Last sector, +/-sectors or +/-size{K,M,G,T,P} (39856128-62914559, default 62914559): +11G
Value out of range.
Last sector, +/-sectors or +/-size{K,M,G,T,P} (39856128-62914559, default 62914559): +10G

Created a new partition 8 of type 'Linux' and of size 10 GiB.

Command (m for help): p
Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
Disk model: VBOX HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf458a236

Device     Boot    Start      End  Sectors Size Id Type
/dev/sda1           2048  2099199  2097152   1G 83 Linux
/dev/sda2        2099200  6293503  4194304   2G 83 Linux
/dev/sda3        6293504 27265023 20971520  10G 83 Linux
/dev/sda4       27265024 62914559 35649536  17G  5 Extended
/dev/sda5       27267072 31461375  4194304   2G 83 Linux
/dev/sda6       31463424 35657727  4194304   2G 83 Linux
/dev/sda7       35659776 39854079  4194304   2G 83 Linux
/dev/sda8       39856128 60827647 20971520  10G 83 Linux

Filesystem/RAID signature on partition 2 will be wiped.
Filesystem/RAID signature on partition 5 will be wiped.

  • 4.30

sudo 설정 방법(임시방편)

  1. 계정 생성 및 wheel 그룹에 포함시키기
    [root@itbank ~]# useradd admin -G wheel
  2. visudo (/etc/sudoers 편집)
    [root@itbank ~]# visudo
    (vi에서)
    98ggx 101ggx (98번째 줄의 주석 해제, 101번째 줄의 주석 해제)
    :wq (저장 및 종료)
  3. 내용 확인 - 일단 임시적으로 wheel 그룹으로 포함

[root@itbank ~]# cat -n /etc/sudoers | head -101 | tail -5
97 ## Allows people in group wheel to run all commands
98 %wheel ALL=(ALL) ALL
99
100 ## Same thing without a password
101 %wheel ALL=(ALL) NOPASSWD: ALL```


root@nc7:~# useradd k1
root@nc7:~# passwd k1
New password:
Retype new password:
passwd: password updated successfully


root@nc7:~# nl /etc/passwd -4
    29  smmta:x:109:114:Mail Transfer Agent,,,:/var/lib/sendmail:/usr/sbin/nologin
    30  smmsp:x:110:115:Mail Submission Program,,,:/var/lib/sendmail:/usr/sbin/nologin
    31  tomcat:x:999:999:Apache Tomcat:/var/lib/tomcat:/usr/sbin/nologin
    32  k1:x:1001:1001::/home/k1:/bin/sh		- 생성 확인

root@nc7:~# ls /home/
j  lost+found

root@nc7:~# tail -3 /etc/passwd		- 끝 3자리만 출력
smmsp:x:110:115:Mail Submission Program,,,:/var/lib/sendmail:/usr/sbin/nologin
tomcat:x:999:999:Apache Tomcat:/var/lib/tomcat:/usr/sbin/nologin
k1:x:1001:1001::/home/k1:/bin/sh


root@nc7:~# apt list | wc -l		- 설치한 목록 갯수 확인

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

74288


root@nc7:~# uname -r			- 커널 화깅
5.15.0-71-generic


root@nc7:~# ls /boot/
System.map-5.15.0-71-generic  grub        initrd.img-5.15.0-71-generic  lost+found  vmlinuz-5.15.0-71-generic
config-5.15.0-71-generic      initrd.img  initrd.img.old                vmlinuz     vmlinuz.old



root@nc7:~# file /boot/vmlinuz-5.15.0-71-generic		- 버전 정보 확인
/boot/vmlinuz-5.15.0-71-generic: Linux kernel x86 boot executable bzImage, version 5.15.0-71-generic (buildd@lcy02-amd64-044) #78-Ubuntu SMP Tue Apr 18 09:00:29 UTC 2023, RO-rootFS, swap_dev 0XB, Normal VGA


root@nc7:~# adduser k2
Adding user `k2' ...
Adding new group `k2' (1002) ...
Adding new user `k2' (1002) with group `k2' ...
Creating home directory `/home/k2' ...
Copying files from `/etc/skel' ...
				  └> skeleton


root@nc7:~# adduser k2
Adding user `k2' ...
Adding new group `k2' (1002) ...
Adding new user `k2' (1002) with group `k2' ...
Creating home directory `/home/k2' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for k2
Enter the new value, or press ENTER for the default
        Full Name []: il
        Room Number []: 501
        Work Phone []: 010-1234-5678
        Home Phone []: 010-1234-6788
        Other []: 010-1234-5678
Is the information correct? [Y/n] y

root@nc7:~# ls /home/
j  k2  lost+found

root@nc7:~# tail -3 /etc/passwd
tomcat:x:999:999:Apache Tomcat:/var/lib/tomcat:/usr/sbin/nologin
k1:x:1001:1001::/home/k1:/bin/sh
k2:x:1002:1002:il,501,010-1234-5678,010-1234-6788,010-1234-5678:/home/k2:/bin/bash


k2(계정 명 ):	x:	1002:	1002:	il,501,010-1234-5678,010-1234-6788,010-1234-5678:	/home/k2:	/bin/bash



> 차이점 확인
k1

$ echo $SHELL
/bin/sh

$ echo ~
/home/k1
$ pwd
/

$ mkdir /home/k1		- 본인이 직접 생성 x =  root 에서 생성해야함
mkdir: cannot create directory ‘/home/k1’: Permission denied

$ echo $SHELL
/bin/sh
$ echo ~				- 생성된 모습
/home/k1


k2

k2@nc7:~$ pwd
/home/k2

k2@nc7:~$ echo $SHELL
/bin/bash

k2@nc7:~$ echo ~
/home/k2
	
(재접속)
k1@nc7:~$ echo ~
/home/k1
k1@nc7:~$ echo $SHELL			- 바뀐거 확인
/bin/bash




> 차이점 확인
k1@nc7:~$ ls -al
total 8
drwxr-xr-x 2 root root 4096 Apr 28 10:15 .
drwxr-xr-x 6 root root 4096 Apr 28 10:15 ..
------------------------------------------------
k2@nc7:~$ ls -al
total 28
drwxr-x--- 3 k2   k2   4096 Apr 28 10:13 .
drwxr-xr-x 6 root root 4096 Apr 28 10:15 ..
-rw-r--r-- 1 k2   k2    220 Apr 28 10:10 .bash_logout
-rw-r--r-- 1 k2   k2   3771 Apr 28 10:10 .bashrc
drwx------ 2 k2   k2   4096 Apr 28 10:13 .cache
-rw-r--r-- 1 k2   k2   2078 Apr 28 10:10 .kshrc
-rw-r--r-- 1 k2   k2    807 Apr 28 10:10 .profile



k2@nc7:~$ fallocate -l 3.5G a2		-  파일 생성
k2@nc7:~$
k2@nc7:~$ ls -Al
total 3670040
-rw-r--r-- 1 k2 k2        220 Apr 28 10:10 .bash_logout
-rw-r--r-- 1 k2 k2       3771 Apr 28 10:10 .bashrc
drwx------ 2 k2 k2       4096 Apr 28 10:13 .cache
-rw-r--r-- 1 k2 k2       2078 Apr 28 10:10 .kshrc
-rw-r--r-- 1 k2 k2        807 Apr 28 10:10 .profile
-rw-rw-r-- 1 k2 k2 3758096384 Apr 28 10:29 a2

k2@nc7:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           198M  804K  197M   1% /run
/dev/sda4        12G  3.8G  7.4G  34% /
tmpfs           988M     0  988M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/sda5       4.9G  3.6G  1.1G  77% /home
/dev/sda6       9.8G   24K  9.3G   1% /data
/dev/sda2       974M  130M  777M  15% /boot
tmpfs           198M  4.0K  198M   1% /run/user/1000
tmpfs           198M  4.0K  198M   1% /run/user/1001
tmpfs           198M  4.0K  198M   1% /run/user/1002

k2@nc7:~$ du -sh ~
3.6G    /home/k2

------------------------------------


root@nc7:~# useradd		- root 권한의 최대
Usage: useradd [options] LOGIN
       useradd -D
       useradd -D [options]

Options:
      --badnames                do not check for bad names
  -b, --base-dir BASE_DIR       base directory for the home directory of the
                                new account
      --btrfs-subvolume-home    use BTRFS subvolume for home directory
  -c, --comment COMMENT         GECOS field of the new account
  -d, --home-dir HOME_DIR       home directory of the new account
  -D, --defaults                print or change default useradd configuration
  -e, --expiredate EXPIRE_DATE  expiration date of the new account
  -f, --inactive INACTIVE       password inactivity period of the new account
  -g, --gid GROUP               name or ID of the primary group of the new
                                account
  -G, --groups GROUPS           list of supplementary groups of the new
                                account
  -h, --help                    display this help message and exit
  -k, --skel SKEL_DIR           use this alternative skeleton directory
  -K, --key KEY=VALUE           override /etc/login.defs defaults
  -l, --no-log-init             do not add the user to the lastlog and
                                faillog databases
  -m, --create-home             create the user's home directory
  -M, --no-create-home          do not create the user's home directory
  -N, --no-user-group           do not create a group with the same name as
                                the user
  -o, --non-unique              allow to create users with duplicate
                                (non-unique) UID
  -p, --password PASSWORD       encrypted password of the new account
  -r, --system                  create a system account
  -R, --root CHROOT_DIR         directory to chroot into
  -P, --prefix PREFIX_DIR       prefix directory where are located the /etc/* files
  -s, --shell SHELL             login shell of the new account
  -u, --uid UID                 user ID of the new account
  -U, --user-group              create a group with the same name as the user
  -Z, --selinux-user SEUSER     use a specific SEUSER for the SELinux user mapping
      --extrausers              Use the extra users database


--  root에서만  가능한 useradd  옵션들




root@nc7:~# useradd -D		- default 값 
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/sh
SKEL=/etc/skel
CREATE_MAIL_SPOOL=no



root@nc7:~# nl /etc/default/useradd
     1  # Default values for useradd(8)
     2  #
     3  # The SHELL variable specifies the default login shell on your
     4  # system.
     5  # Similar to DSHELL in adduser. However, we use "sh" here because
     6  # useradd is a low level utility and should be as general
     7  # as possible
     8  SHELL=/bin/sh		- shell  연결 확인
     9  #
    10  # The default group for users
    11  # 100=users on Debian systems
    12  # Same as USERS_GID in adduser
    13  # This argument is used when the -n flag is specified.
    14  # The default behavior (when -n and -g are not specified) is to create a
    15  # primary user group with the same name as the user being added to the
    16  # system.
    17  # GROUP=100
    18  #
    19  # The default home directory. Same as DHOME for adduser
    20  # HOME=/home
    21  #
    22  # The number of days after a password expires until the account
    23  # is permanently disabled
    24  # INACTIVE=-1
    25  #
    26  # The default expire date
    27  # EXPIRE=
    28  #
    29  # The SKEL variable specifies the directory containing "skeletal" user
    30  # files; in other words, files such as a sample .profile that will be
    31  # copied to the new user's home directory when it is created.
    32  # SKEL=/etc/skel
    33  #
    34  # Defines whether the mail spool should be created while
    35  # creating the account
    36  # CREATE_MAIL_SPOOL=yes



root@nc7:~# vi /etc/login.defs
 13 CREATE_HOME yes		-추가




root@nc7:~# useradd k3
root@nc7:~# passwd k3
New password:
Retype new password:
passwd: password updated successfully

root@nc7:~# mkdir /etc/skel/TTT
root@nc7:~# date > /etc/skel/a1

root@nc7:~# useradd k4
root@nc7:~# passwd k4
New password:
Retype new password:
passwd: password updated successfully



$ pwd			-  k4로 접속했을시 정상적으로 실행되었음을 확인
/home/k4
$ ls
TTT  a1
$

rot@nc7:~# finger k1
Login: k1                               Name:
Directory: /home/k1                     Shell: /bin/bash
On since Fri Apr 28 10:18 (KST) on pts/7 from 10.0.2.2
   34 minutes 24 seconds idle
No mail.
No Plan.


root@nc7:~# finger k2
Login: k2                               Name: il
Directory: /home/k2                     Shell: /bin/bash
Office: 501, 010-1234-5678              Home Phone: 010-1234-6788
On since Fri Apr 28 10:13 (KST) on pts/6 from 10.0.2.2
   24 minutes 17 seconds idle
No mail.
No Plan.


root@nc7:~# chfn k1		- 사용자 정보 입력하기
Changing the user information for k1
Enter the new value, or press ENTER for the default
        Full Name []: ilil
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
root@nc7:~#
root@nc7:~# finger k1
Login: k1                               Name: ilil
Directory: /home/k1                     Shell: /bin/bash
On since Fri Apr 28 10:18 (KST) on pts/7 from 10.0.2.2
   35 minutes 13 seconds idle
No mail.
No Plan.

root@nc7:~# useradd -D		- default 값
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/sh
SKEL=/etc/skel
CREATE_MAIL_SPOOL=no

root@nc7:~# usermod -L k4

login as: k4			- user에게 LOCK이 정상적으로 걸림
k4@127.0.0.1's password:
Access denied
k4@127.0.0.1's password:
Access denied
k4@127.0.0.1's password:
k4@127.0.0.1's password:

root@nc7:~# usermod -U k4	-정상적으로 로그인
Welcome to Ubuntu 22.04.2 LTS (GNU/Linux 5.15.0-71-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

This system has been minimized by removing packages and content that are
not required on a system that users do not log into.

To restore this content, you can run the 'unminimize' command.
Last login: Fri Apr 28 10:38:12 2023 from 10.0.2.2
$





root@nc7:~# userdel -r k1		- 로그인 되어있기에 삭제 불가
userdel: user k1 is currently used by process 1388


root@nc7:~# userdel -r k1
userdel: k1 mail spool (/var/mail/k1) not found
userdel: /home/k1 not owned by k1, not removing

root@nc7:~# tail -4 /etc/passwd		- 정상적으로 삭제가 되었음을 확인
tomcat:x:999:999:Apache Tomcat:/var/lib/tomcat:/usr/sbin/nologin
k2:x:1002:1002:il,501,010-1234-5678,010-1234-6788,010-1234-5678:/home/k2:/bin/bash
k3:x:1003:1003::/home/k3:/bin/sh
k4:x:1004:1004::/home/k4:/bin/sh


root@nc7:~# nl /etc/passwd
     1  root:x:0:0:root:/root:/bin/bash
     2  daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
     3  bin:x:2:2:bin:/bin:/usr/sbin/nologin
 ,,,
    33  k3:x:1003:1003::/home/k3:/bin/sh
    34  k4:x:1004:1004::/home/k4:/bin/sh

root@nc7:~# userdel k2

root@nc7:~# nl /etc/shadow		
     1  root:*:19405:0:99999:7:::
     2  daemon:*:19405:0:99999:7:::
     3  bin:*:19405:0:99999:7:::
    ,,,
    25  sshd:*:19405:0:99999:7:::
    26  usbmux:*:19474:0:99999:7:::
    27  j:$6$E4UXUc2NC9Kgi7Xy$yvINee0CkMy4OwkjLbNOrWvHJCCyTApxN0tsaWWEkAWdGq91RkTdvwZggUMv5T95qhY.7qnfpi0e8nBU/hSdD0:19474:0:99999:7:::
    28  mysql:!:19474:0:99999:7:::
    29  smmta:*:19474:0:99999:7:::
    30  smmsp:*:19474:0:99999:7:::
    31  tomcat:!*:19474::::::
    32  k3:$y$j9T$K7t0u9gefb7WRq1p2e1zR/$ZjGCYw1TR8qRnSimDrbgn.YRXUs4XkYrCoeVgF67iJB:19475:0:99999:7:::
    33  k4:$y$j9T$AGhLfZDmkYwqBqN4SA8mk/$ziqhfFodOri/ArZXv5xvl1iYF4cj76nloWFhfK67hbB:19475:0:99999:7:::




root@nc7:~# pwunconv

https://starrykss.tistory.com/1639

root@nc7:~# nl /etc/shadow	- 열림 해제
nl: /etc/shadow: No such file or directory


root@nc7:~# nl /etc/passwd | tail -5
    29  smmta:*:109:114:Mail Transfer Agent,,,:/var/lib/sendmail:/usr/sbin/nologin
    30  smmsp:*:110:115:Mail Submission Program,,,:/var/lib/sendmail:/usr/sbin/nologin
    31  tomcat:!*:999:999:Apache Tomcat:/var/lib/tomcat:/usr/sbin/nologin
    32  k3:$y$j9T$K7t0u9gefb7WRq1p2e1zR/$ZjGCYw1TR8qRnSimDrbgn.YRXUs4XkYrCoeVgF67iJB:1003:1003::/home/k3:/bin/sh
    33  k4:$y$j9T$AGhLfZDmkYwqBqN4SA8mk/$ziqhfFodOri/ArZXv5xvl1iYF4cj76nloWFhfK67hbB:1004:1004::/home/k4:/bin/sh

vi /etc/default/useradd
  8 SHELL=/bin/sh



vi etc/login.defs
  2 # /etc/login.defs - Configuration control definitions for the login package.
 35 MAIL_DIR        /var/mail		- 메일 정리 함
 36 #MAIL_FILE      .mail
  • 5.02

root@nc7
15:03:23:/etc/bind# kbs="asdfasdfasdfasdfa"

root@nc7
15:03:31:/etc/bind# echo $kbs
asdfasdfasdfasdfa

root@nc7
15:03:43:/etc/bind# echo $kbs_awerwer
asdfasdfasdfasdfa						- "awerwer" 실행 x

root@nc7
15:03:47:/etc/bind# echo ${kbs}_awerwer		- {}로 변수 선언
asdfasdfasdfasdfa_awerwer			- 출력되는 모습

profile
☁️ 좋아요!

0개의 댓글