Let's get started by opening up the terminal. And yes, I've spent many hours trying to find a gui option for this since I hate the terminal. But, this was in the end the easiest way.
Mounting
First, we create a mount point:
mkdir /media/folder/optionalfolder
Then install utils (could already be installed but do it anyway just in case:
sudo yum install samba-client samba-common cifs-utils
Test the connection to our server. Before doing this you need to know the local IP address to your server. The easiest way in my opinion is to just connect to your router and see what's connected. Lets assume your network drive has IP 100:
smbclient -L 192.168.0.100/ -U YourUserName
# Enter password for user "YourUserName"
# Once it connects, just exit
Now mount the share the default linux way, in terminal of course 😒:
sudo mount -t cifs -o username=YourUserName //192.168.0.100/ /media/folder
# Enter password for user "YourUserName"
From here we are good to go. But if you want the drive to be persistent, we need to create a credentials file and then edit fstab:
Automount at login
Create your password in a single file on your home drive. This does not have to be done in the terminal, I used the text editor Kate for this.
In the terminal:
sudo touch ~/.smbcreds
sudo vi .smbcreds
Enter your Windows username and password in the file:
username=YourUserName password=YourPAsswordThen set permissions for the file in terminal.
chmod 600 ~/.smbcreds
Now we add to /etc/fstab (auto-mount). again, don't have to be done in the terminal.
sudo vi /etc/fstab
Add:
//192.168.0.100/ /media/folder/optionalfolder cifs credentials=/home/user/.smbcreds,_netdev,defaults 0 0And that's it. Your network drive will no show up as a mounted drive and you can access it just like a normal drive or partition.
- 0 comments
- 87 views