Linux / Unix

Linux Admin

Books

User / Group

  • Add New Users

$ sudo groupadd -g 4000 caltech
# ====================================
# -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

Nvidia

  • Ubuntu

# Disable Secure Boot!

# 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

ZFS

NAS

  • AFP

    • netatalk

$ sudo apt install netatalk
$ sudo systemctl restart netatalk.service
==========================================
# /etc/netatalk/afp.conf
[myafp]
path = /zfs_pool/myafp valid users = cory

    • avahi

$ sudo apt install avahi-deamon
$ 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

Client

  • Permission

$ chmod 700 ~/.ssh
$
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

Host ShortNameForConnection
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

$ ssh -ND 8899 sshServerIP

Server

  • Installation

$ sudo apt-get install openssh-server
# finished!

# Checking status
$ sudo service ssh status

# Change Configuration
$ sudo vim /etc/ssh/sshd_config
$ sudo service ssh restart

  • Permission

$ chmod 700 ~/.ssh
$ chmod 644 ~/.ssh/known_hosts
$ restorecon -R -v ~/.ssh