Mount a Windows Fileshare
Requirements
Share the Directory on Windows
- Open File Explorer.
- Right click on the directory you want to share.
- Click 'Show more options'.
- Click 'Give access to' -> 'Specific people...'
- On the drop-down menu, find 'Everyone'.
- (Optional) change 'Read' to 'Read/Write'.
- Click 'Share'.
Check the IP address on Windows by opening CMD and running
1ipconfig
Mount the Shared Windows Directory on Linux
Install cifs-utils and smbclient.
Add the windows password to pass, then check the output.
1pass windows
Create a mount directory:
1windir=/mnt/windows
2sudo mkdir ${windir}
3sudo chown $USER ${windir}
Specify the username and IP address, then mount that directory:
1winuser=Alice
2windows_ip=192.168.0.13
3
4sudo mount -t cifs -o username=${winuser},uid=$UID,password="$(pass windows)" //${windows_ip}/Users ${windir}
5
6ls ${windir}
Check it works, then unmount:
1sudo fusermount3 -u ${windir}
Alias
Make an alias for easy mounting and unmounting.
1alias mwin='sudo mount -t cifs -o username=${winuser},uid=$UID,password="$(pass windows)" //${windows_ip}/Users ${windir}'
2alias mwinrm='sudo fusermount3 -u ${windir}'