[]
Most of this information is from here. First we need to install Samba
sudo apt-get install samba
sudo apt-get install samba-common-bin
Set a password for Samba
sudo smbpasswd -a user_name
where "user_name" should be replaced with your username (maybe pi?).
Let's assume that your the folder you'd like to share is at /home/user_name/shared_folder. We need to edit one file:
sudo nano /etc/samba/smb.conf
Add the following the end of the file:
[shared_folder] path = /home/user_name/shared_folder available = yes valid users = user_name read only = no browseable = yes public = yes writable = yes
where again, "user_name" should be replaced with your username.
Now restart the Samba server.
sudo service samba restart
To access your shared folder on another network computer, type
smbclient //host_IP/shared_folder
This will then prompt for the Samba login credentials. If successful, you'll get a prompt that says
smb: \>
Type dir to list the contents of the share drive. If this works, you've successfully accessed the shared folder, and your Samba server is working properly.
[]
First you'll need to create a folder where you'll mount the network share.
sudo mkdir /mnt
sudo mkdir /mnt/mydrivename
You'll also want to change the permissions on the new mount folder
sudo chmod 775 /mnt/mydrivename
This combination (775) provides read, write, execute permissions to all the current user and group, and only read, execute permissions to the rest of the world. Here's a link showing various chmod configurations.
To mount the drive, type
sudo mount -t cifs -o username=XXX,password=YYY //host_IP/shared_folder /mnt/mydrivename
Here, of course, replace "XXX" with the Samba username, "YYY" with the Samba password, "host_IP" with the IP address (or host name) that's sharing the folder, "shared_folder" with the actual name of the shared folder in the Samba server's /etc/samba/smb.conf, and "/mnt/mydrivename" with the location of the folder where your want to mount the drive.
If you're successful, you should be able to browse the contents of the network drive.
dir /mnt/mydrivename
[]
To mount the shared folder automatically on boot, we simply need to modify one line of /etc/fstab.
sudo nano /etc/fstab
At the end of the list, add a line with the following information, separated by tabs:
//host_IP/shared_folder /mnt/mydrivename cifs username=XXX,password=YYY 0 0
Where again, you should replace "XXX" with the Samba username, "YYY" with the Samba password, "host_IP" with the IP address (or host name) that's sharing the folder, "shared_folder" with the actual name of the shared folder in the Samba server's /etc/samba/smb.conf, and "/mnt/mydrivename" with the location of the folder where your want to mount the drive.
Here's an example of my /etc/fstab file:
When you reboot, you should be able to go directly to your newly-mounted drive.
[]
To share a Windows folder to a Linux computer, I kindly refer you to this great tutorial:
http://www.howtogeek.com/176471/how-to-share-files-between-windows-and-linux/
No Comments Yet