---
tags: Ubuntu
---
How to Mount Windows Shared Folder on Ubuntu
==
## Method 1 (Recommended)
### Step 1 - Ask server admin for sudoer permission
Edit "/etc/sudoers" file, and append the following line.
```shell
xavierlin ALL=(root) /usr/bin/mount, /usr/bin/umount
```
### Step 2 - Install cifs-utils
To mount a shared folder you must install this package, otherwise you will get a very confusing error message when mounting a folder.
> mount: /home/xavierlin/source: cannot mount xxx read-only.
Reference: https://askubuntu.com/questions/1113874/mount-t-cifs-results-in-cannot-mount-readonly-error
### Step 3 - Mount
```shell
sudo mount -t cifs -o rw,user=xavier,uid=xavierlin //10.77.215.100/hdp folder
```
* `user` is the user name you pass to the server as credentials.
* `uid` is the user name on the client that is mounting the share.
Reference: https://askubuntu.com/questions/1203832/how-to-mount-smb-share-on-ubuntu-18-04-with-read-write-from-the-terminal
## Method 2
Use this method if you are not able to acquire sudoer permission for mount/umount.
Note that though you can mount a shared folder, you will still have several permission limitations on the mounted folder.
**Solution:** Use `gio mount` util.
1. Make the Windows folder you want to mount as a shared folder.
2. `gio mount smb://10.77.215.100/hdp`
> Password required for share hdp on 10.77.215.100
> User [xavierlin]: (your Windows user name)
> Domain [WORKGROUP]: (type enter to use default value)
> Password: (your Windows password)
3. Type `id` to see your user id on Ubuntu.
4. Navigate to "/run/user/$userid/gvfs/", you will see a folder like "smb-share:server=10.77.215.100,share=hdp".
5. Optionally use `ln -s` to create a link to the shared folder.
Reference: https://psychcns.freshdesk.com/support/solutions/articles/43000532428-mount-smb-file-share-from-linux-using-gio