---
# System prepended metadata

title: Shared Folder
tags: [tools]

---

###### tags: `tools`
# Shared Folder
## SMB
### Windows
#### Client 
using samba for share folder
`net share [ShareValue]=[C:\] /grant:Everyone,FULL`

delete share folder
`net share [ShareValue] /delete`
#### Server
mount client folder to local disk path
`net use [E:] \\[Host]\[ShareValue] /user:[User] [password]`
unmount 
`net use [x:] /delete`

### Linux
#### Client
1. Edit samba configuration
    `sudo vi /etc/samba/smb.conf`

    ```
    [share]
       path = /
       valid users = user
       read only = no
       browseable = yes
    ```
2. Add samba user
add a exist system user to smb
    `sudo smbpasswd -a [user]`
4. Restart samba
    `sudo service smbd restart`
#### Server
mount client folder to local disk path
`sudo mount -t cifs //[Host]/[ShareValue] [LocalPath] -o username=[Username],password=[Password]`
unmount 
`umount [LocalPath]`
## NFS
1. Install
    `yum install nfs-utils` or `apt-get install nfs-kernel-server`
2. Edit configuration
    `/etc/exports`
    ```
    /nfs_share [Host](rw,sync,no_subtree_check)
    ```
    “rw”表示讀寫，“sync”表示同步，“no_subtree_check”表示在子目錄中不檢查權限
3. Restart service
    `service nfs-kernel-server restart`
4. Mount folder    
    `mount -o anon \\[Host]\[NFS_SHARE] [C:\MOUNT_POINT]`
    

