篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown Linux Ubuntu Snippets相关的知识,希望对你有一定的参考价值。
Umount the filesystem and then run `hdparm -S 1 /dev/sdb` to set it to spin down after five seconds (replace `/dev/sdb` with the actual device for the hard disk). This will minimize the power used and heat generated by the hard disk.
**Fire up a terminal.**
1. **[IMPORTANT]** `sudo cp /etc/fstab /etc/fstab.old` - Create a backup of the fstab file just in case something unwanted happens.
2. `sudo blkid` - Note the UUID of the partition you want to automount.
3. `sudo nano /etc/fstab` - Copy the following line to the end of the file, save it and reboot afterwards to check if it worked.
4. `mkdir /my/path/tomount` # to quote : "you must create the mount point before you mount the partition." see <https://help.ubuntu.com/community/Fstab>
## Examples
A common setup is:
```
UUID=<uuid> <pathtomount> <filesystem> defaults 0 0
```
Use `lsblk -o NAME,FSTYPE,UUID` to find out the UUIDs and filesystems of the partition you want to mount. For example:
```
$ lsblk -o NAME,FSTYPE,UUID
NAME FSTYPE UUID
sda
├─sda2
├─sda5 swap 498d24e5-7755-422f-be45-1b78d50b44e8
└─sda1 ext4 d4873b63-0956-42a7-9dcf-bd64e495a9ff
```
### NTFS
```
UUID=<uuid> <pathtomount> ntfs uid=<userid>,gid=<groupid>,umask=0022,sync,auto,rw 0 0
```
**Examples** for the `<>` variables:
- `<uuid>`=`3087106951D2FA7E`
- `<pathtomount>`=`/home/data/` # create this before rebooting
- `<userid>`=`1000`
- `<groupid>`=`1000`
Use `id -u <username>` to get the userid and `id -g <username>` to get the groupid.
(Note that specifying the `sync` option can slow down write performance as it disables the cache. async is the default.)
`UUID=EEA2B69CA2B668AB /WIN_C ntfs-3g defaults,nls=utf8,umask=000,dmask=027,fmask=137,uid=1000,gid=1000,windows_names 0 0 `
# How can I give full permission to folder and subfolder
Press Ctrl+Alt+T to go to a terminal and type:
``
sudo mkdir /var/szDirectoryName
``
``
sudo chmod a+rwx /var/szDirectoryName
``
# Mount all drives on fstab
`mount -a`
```bash
sudo nano /etc/samba/smb.conf
[accounts]
comment = Accounts data directory
path = /data/accounts
valid users = vivek raj joe
public = no
writable = yes
force user = userXXXXXX
sudo smbpasswd -a user
sudo chown user:sambashare /media/device/
sudo chmod 2770 /media/device/
sudo systemctl restart smbd.service nmbd.service
```