Tips
About 1 min
Tips κ΄λ ¨
ssh-keygen
id_rsa
νμΌ μμ±
1
Generate SSH Key Pair
μ: λ μ΄λΈμ νμ¬ email (i.e.
itcloud@ititinfo.com
) λ‘ μ§μ
ssh-keygen -t rsa -b 4096 -C "itcloud@ititinfo.com"
#
# Generating public/private rsa key pair.
# Enter file in which to save the key (<HOME>/.ssh/id_rsa):
# Enter passphrase (empty for no passphrase):
# Enter same passphrase again:
# Your identification has been saved in <HOME>/.ssh/id_rsa.
# Your public key has been saved in <HOME>/.ssh/id_rsa.pub.
# The key fingerprint is:
# SHA256:9n/SUIwvLLTZBhssUJD8HTN1HB2RYG1p+aSw/g9O3po itcloud@ititinfo.com
# The key's randomart image is:
# +---[RSA 4096]----+
# | ..+. ..+==*|
# | + + o..Bo|
# | o o + =oo.|
# | o * o + .|
# | So X o |
# | . .= B . |
# | .o =o |
# | ..+++ |
# | .oEoo|
# +----[SHA256]-----+
-t rsa
: Specifies the type of key to create, which is RSA.-b 4096
: Specifies the number of bits in the key. 4096 bits is generally considered secure.-C "your_email@example.com"
: Adds a label to the key for identification.
You will be prompted to enter a file name to save the key and a passphrase. You can press Enter to accept the default file name (id_rsa
) and leave the passphrase empty for no passphrase.
2
Copy Public Key to Remote Server
ssh-copy-id -i ~/.ssh/id_rsa.pub itcloud@ititinfo.com
User Permission
Sudoer λ±λ‘
sudo adduser <newuser>
usermod -aG sudo <newuser>
μ μ©ν 컀맨λ λͺ¨μ
uptime # μ΄μμκ°
hostname # νΈμ€νΈλͺ
hostname -I | sed "s/\s.*$//" # νΈμ€νΈμ IPμ£Όμ (첫λ²μ§Έλ§)
uname -a # OS μ 보
lscpu # CPU κΈ°λ³Έ μ 보
sar # CPU μ¬μ©λ₯ λ° μν
cat /proc/cpuinfo # CPU μ½μ΄λ³ μ 보 μΆλ ₯
cat /proc/cpuinfo | egrep -i "processor" | wc -l # CPU μ½μ΄ κ°μ
cat /proc/meminfo # λ©λͺ¨λ¦¬ μ 보
cat /proc/mounts | egrep -i ro, | egrep -v "tmp|iso9660" # λμ€ν¬ λ΄ νμΌ ReadOnly μν νμΈ
ps -ef | wc -l | grep -iv uid # νλ‘μΈμ€ μν κ°μ
free -h # λ©λͺ¨λ¦¬ μν (`-g` νλκ·Έ μΆκ° μ, GBλ¨μ)
df -Th | egrep -v tmpfs | sort -k6 -r # λμ€ν¬ μ¬μ©μν
df -Th | grep xfs # λ‘컬볼λ₯¨
fdisk -l # RAID κ΅¬μ± μ¬λΆ λ° μν
cat /var/log/messages # μμ€ν
μλ¬ λ‘κ·Έ (`erro`, `crit`, `warn` μ΄ λμ€μ§ μμΌλ©΄ μ μ)
cat /etc/sysconfig/network-scripts/ifcfg-eth0 # λ·λ§μ€νΉ λ° κ²μ΄νΈμ¨μ΄ μ 보
cat /etc/hostname # νΈμ€νΈλͺ
cat /etc/hosts # λͺ¨λ νΈμ€νΈλͺ
cat /etc/hosts.deny # κ±°λΆλμ νΈμ€νΈλͺ
cat /etc/redhat-release # (RHEL/CentOS/Fedora/Ubuntu Linux) OS λ²μ
cat /etc/ssh/sshd_config | egrep "Port|PermitRootLogin" # root μ§μ μ μκΆν νμΈ
cat /etc/rc.d/rc.local # λΆν
μ μ€ννλ μ€ν¬λ¦½νΈ
cat /etc/yum.repos.d/local.repo # μ€μΉλ yum pm μν (CentOS)
dmesg # λΆν
λ‘κ·Έ (`erro`, `crit`, `warn` μ΄ λμ€μ§ μμΌλ©΄ μ μ)
ifconfig # λ€νΈμν¬ μν
route # λΌμ°ν
ν
μ΄λΈ μν
systemctl status firewalld # λ°©νλ²½ μ€μ μν (RHEL/CentOS/Fedora/Ubuntu Linux)
systemctl is-enabled firewalld # λ°©νλ²½ νμ±ν μν (RHEL/CentOS/Fedora/Ubuntu Linux)
netstat -anp | egrep -i list | egrep -v "unix|tcp6" # μ¬μ©κ°λ₯ ν¬νΈ νμΈ
netstat -nr # μ¬μ©κ°λ₯ ν¬νΈ νμΈ
netstat -anp | grep SYN_RECV | wc -l # SYN Flooding 곡격 κ°λ₯μ± μ κ² (1000λ―Έλ§μΌ κ²½μ° μ μ)
chage -l <κ³μ λͺ
> | grep -i "^password " # μ¬μ©μ κ³μ λΉλ°λ²νΈ λ§λ£μ¬λΆ
chage -d <YYYY-MM-DD> <κ³μ λͺ
> # μ¬μ©μ κ³μ κ°±μ ν μΌμ μ§μ
########## κ³ κΈ - κ³΅ν΅ ##########
echo $(TZ=KST+15;date +%y%m%d) # μ΄μ λ μ§ μΆλ ₯ (`yyyyMMdc` ν¬λ©§)
########## κ³ κΈ - RedHat κ³μ΄ Only ##########
OS_VERSION=$(sed 's/.*release \([0-9]\).*/\1/' /etc/redhat-release) # OS μ 보
LANG=C /sbin/ifconfig | awk '/inet / {split($2,arr,":"); print arr[2]}' # λ€νΈμν¬ μΈν°νμ΄μ€λͺ
μ λΉΌκ³ IPμ£Όμλ§ μ°κ³ μΆμ λ μ¬μ©νλ λͺ
λ Ήμ΄