Linux Noob Reference list

Home | Websites | | Muziek | Over

Licht uit/aan


Services

Check services running:
sudo service --status-all

Install ssh server:
sudo apt-get install ssh
allow port 22 on firewall:
sudo ufw allow 22

Restart dns server:
sudo /etc/init.d/bind9 restart

User Management

Add a user:
sudo useradd -d /data/home/%username% -m %username%

Delete a user:
sudo userdel %username%

Set User password:
sudo passwd %username%

Create a Samba User:
smbpasswd -a %username%

Display Samba Users
sudo pdbedit -L -v

System

Remove network manager:
sudo apt-get purge network-manager

Check your distro version:
cat /etc/os-release

32-bit or 64-bit system
uname -a
32-bit ("i686" or "i386") or 64-bit ("x86_64")

Authentication

Generate a ssh key
On the source machine:
ssh-keygen -t rsa -C %user%@%target%
cat ~/.ssh/id_rsa.pub | ssh %user%@%target% 'cat >> .ssh/authorized_keys'

File Rights

Change User and Group Ownership Recursive:
sudo chown -R %USER%:%GROUP% %SOURCERECTORY% %DESTINATIONDIRECTORY%

Drives & Partitions

(Re)Mount an external drive on boot;
Step 1: Create a mount point for the drive:
sudo mkdir /mnt/%name_of_the_directory%
Step 2: Identify the UUID from the drive:
"sudo blkid -o list"
Step 3: Add the uuid to the /etc/fstab file like so:
For example to add the UUID "9b9dd266-1ee9-41f1-87aa-82f39fd1cf25" ext4 formatted drive to /etc/fstab:
Step 4: Add this line at the end:
UUID=9b9dd266-1ee9-41f1-87aa-82f39fd1cf25 /mnt/%name_of_the_directory% ext4 defaults 0
Step 5: Reboot and see if it worked out!!

Autostart a program on login:
Add your program to
~/.config/autostart/ file, f.e. ~/.dropbox-dist/dropboxd