Last active
August 15, 2019 21:15
-
-
Save JonasAlfredsson/623554b47e8b719417a36b8c1c780a62 to your computer and use it in GitHub Desktop.
SMB Mounting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A few different ways you can mount a Samba share on your Linux computer. | |
# First of all you need the `cifs-utils`. | |
sudo apt-get install cifs-utils | |
# Then you can mount the following ways. | |
- Guest account without password. | |
sudo mount -t cifs -o vers=3.0,username=guest,password= //192.168.1.2/Music /home/$USER/Music | |
- Creadentials in command | |
sudo mount -t cifs -o vers=3.0,username=user,password=pass,uid=$USER,gid=$USER //192.168.1.2/Music /home/$USER/Music | |
- Credentials in file | |
sudo mount -t cifs -o vers=3.0,credentials=/secret/file,uid=$USER,gid=$USER //192.168.1.2/Music /home/$USER/Music | |
```/secret/file | |
username=user | |
password=pass | |
``` | |
# Check if the folder is already mounted. | |
if grep -qs "/folder/to/mount" /proc/mounts; then | |
echo "It's mounted." | |
else | |
echo "It's not mounted." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment