Linux / Unix
Linux Admin
Linux Admin
Books
Books
User / Group
User / Group
- Add New Users
# ====================================
# -g GID
$ sudo usermod -a -G caltech feynman
$ sudo usermod -a -G sudo feynman
# ====================================
# -a Append to group
# -G <Groups name>
$ sudo useradd -m feynman
$ sudo useradd -u 3999 -g 4000 -m -c "R. Feynman" -s /usr/bin/bash feynman
# ====================================
# -m Create /home/feynman
# -u UID
# -g GID
# -c Comment (Displayed Name on UI)
# -s Default Shell
# list member in caltech
$ grep caltech /etc/group
# change defalut group
$ usermod -g mit feynman
Network
Network
- Ubuntu 20.04
- Centos
- # /etc/sysconfig/network-scripts/ifcfg-eth0
# Static
DEVICE=enp3s0
ONBOOT=yes
IPADDR=192.168.1.10
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
# DHCP
DEVICE=enp3s0
ONBOOT=yes
DHCP=yes
# After modification
$ ifdown enp0s3
$ ifup enp0s3
- DHCP server
- Show Routing Table
$ netstat -rn
# -n :Display numerical IP addresses, instead of the corresponding host names.
$ ip route list
Nvidia
Nvidia
- Ubuntu
# List proper drivers
$ ubuntu-drivers devices
# Choose one method
1. $ sudo ubuntu-drivers autoinstall
2. $ sudo apt install nvidia-driver-440
# Reboot
$ sudo reboot
# Check devices and cuda driver
$ nvidia-smi
# Install cuda-toolkit
$ sudo apt update
$ sudo apt install nvidia-cuda-toolkit
# Check nvcc
$ nvcc --version
Disk / Partition
Disk / Partition
ZFS
ZFS
NAS
NAS
- AFP
- netatalk
$ sudo systemctl restart netatalk.service
==========================================
# /etc/netatalk/afp.conf
[myafp]
path = /zfs_pool/myafp valid users = cory
- avahi
$ sudo systemctl restart avahi-daemon.service
==========================================
# /etc/avahi/services/afpd.service
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=Xserve</txt-record>
</service>
</service-group>
==========================================
- NFS
- SMB
SSH
SSH
Client
Client
- Permission
$ chmod 644 ~/.ssh/authorized_keys
$ chmod 644 ~/.ssh/config
$ chmod 600 ~/.ssh/id_rsa
$ chmod 644 ~/.ssh/id_rsa.pub
$ restorecon -R -v ~/.ssh
- .ssh/config entry
Hostname ServerIPorDomainName
User YourUsername
IdentityFile ~/.ssh/id_rsa_YourPrivateKey
ProxyCommand ssh name_of_gateway_machine -W %h:%p
LocalForward 8899 localhost:8899
ForwardX11 yes
- Socks proxy
- X-Forwarding (macOS)
- Install XQuartz: https://www.xquartz.org/
Server
Server
- Installation
# finished!
# Checking status
$ sudo service ssh status
# Change Configuration
$ sudo vim /etc/ssh/sshd_config
$ sudo service ssh restart
- Permission
$ chmod 644 ~/.ssh/known_hosts
$ restorecon -R -v ~/.ssh
- Debug
- Slow for login
A comprehensive guide to fixing slow SSH logins
- Slow for login