Linux config

From Personal Wiki
Jump to navigation Jump to search

FSTAB

Set file owner to user which should use mount point e.g.:

sudo chown juraj:juraj /media/mountpoint
sudo chmod 775 /media/mountpoint

Parameters and HINTS for mount points

user - Allow an ordinary user to mount the filesystem. The name of the mounting user is written to mtab so that he can unmount the filesystem again. This option implies the options noexec, nosuid, and nodev (unless overridden by subsequent options, as in the option line user,exec,dev,suid).
nouser - Forbid an ordinary (i.e., non-root) user to mount the filesystem. This is the default.
users - Allow every user to mount and unmount the filesystem. This option implies the options noexec, nosuid, and nodev (unless overridden by subsequent options, as in the option line users,exec,dev,suid).
uid - numerical under who it should be mounted
gid - same, but group ID
umask - should be 002 or 022, smae as subnet wildcard mask, reverted
rw
nofail - continue to boot when fail timeout ends. External devices that are to be mounted when present but ignored if absent may require the nofail option. The nofail option is best combined with the x-systemd.device-timeout option. This is because the default device timeout is 90 seconds, so a disconnected external device with only nofail will make your boot take 90 seconds longer, unless you reconfigure the timeout as shown. Make sure not to set the timeout to 0, as this translates to infinite timeout.
commit - commit=600 ???
errors=remount-ro - remote as readonly when error in mounting occurs
defaults - rw,suid,dev,exec,auto,nouser,async
exec - must be after users if users is used, as users implies noexec

The fifth field, (fs_freq), is used for these filesystems by the dump(8) command to determine which filesystems need to be dumped. If the fifth field is not present, a value of zero is returned and dump will assume that the filesystem does not need to be dumped.

The sixth field, (fs_passno), is used by the fsck(8) program to determine the order in which filesystem checks are done at reboot time. The root filesystem should be specified with a fs_passno of 1, and other filesystems should have a fs_passno of 2. Filesystems within a drive will be checked sequentially, but filesystems on different drives will be checked at the same time to utilize parallelism available in the hardware. If the sixth field is not present or zero, a value of zero is returned and fsck will assume that the filesystem does not need to be checked.

SSD parameters mount to save life of SSD:

noatime - do not write any access timechanges when a change occurss
discard - If  set, causes discard/TRIM commands to be issued to the block device when blocks are freed. This is useful for SSD devices and sparse/thinly-provisioned LUNs.

SMB

sudo apt-get install cifs-utils

nano /home/juraj/.smb

username=user
password=mySecretPassword

nano /etc/fstab

//ip/sharename/ /media/juraj/sharename cifs uid=1000,credentials=/home/juraj/.smb,iocharset=utf8,vers=3.0,noperm 0 0

sudo mount -a