Friday, August 28, 2015

SHARED folder: mount.nfs: Connection timed out

  1. Valpskott is offlineA Carafe of Ubuntu
    Join Date
    Oct 2008
    Location
    Sweden
    Beans
    85
    Distro
    Ubuntu 13.04 Raring Ringtail

    mount.nfs: Connection timed out

    Okay, so I just bought a ReadyNAS nv+ v2, installed an add-on so that I get root-access to it via ssh, and lo and behold, it was running something based on debian-squeeze (ARM).

    On my previous NAS (ubuntu server) I mounted stuff with sshfs, but before retiring that NAS, I tried NFS and it was way faster and more reliable.

    On the new NAS, I can mount via sshfs, but I'd really like to mount via NFS. I'm new to NFS, so I'd like some help.

    What I've done so far.

    Edited /etc/exports
    Code:
    /c/home/johan 10.10.1.190(rw,sync,no_subtree_check)
    /c/home/johan 10.10.1.196(rw,sync,no_subtree_check)
    Then I ran this
    Code:
    exportfs -r
    Yielded no errors


    Then I ran the following command
    Code:
    root@Amunet:/# /etc/init.d/portmap restart
    Stopping portmap daemon....
    Starting portmap daemon....
    root@Amunet:/# /etc/init.d/nfs-common restart
    Stopping NFS common utilities: idmapd statd.
    Starting NFS common utilities: statd idmapd.

    Then on my desktop machine (ubuntu 11.10) I ran
    Code:
    sudo mount 10.10.1.100:/c/home/johan /media/nellie
    and
    Code:
    sudo mount -t nfs 10.10.1.100:/c/home/johan /media/nellie
    which results in the error:
    Code:
    mount.nfs: Connection timed out
    10.10.1.100 is the NAS... YES! "/c/home/johan" is the correct path to the directory I want to share. I guess the "c" is to make windows users comfortable so that they don't have to deal with the unix filesystem.


    Another thing to mention is that, when I ordered this NAS, the shopping site listed it as having NFS support. But on Netgears site they have some pages that says it has NFS support and some that say it does not have NFS. The previous model had NFS. And clearly, the NFS software is there.

    So, it might need some tinkering!

    Anyone up for the challange?
  2. #2
    Valpskott is offlineA Carafe of Ubuntu
    Join Date
    Oct 2008
    Location
    Sweden
    Beans
    85
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: mount.nfs: Connection timed out

    More info:


    Code:
    root@Amunet:/# rpcinfo -p
    program vers proto   port
    100000    2   tcp    111  portmapper
    100024    1   udp  45598  status
    100024    1   tcp  36736  status
    In another forum someone had...

    Code:
    100003 2 udp 2049 nfs
    100003 3 udp 2049 nfs
    100003 4 udp 2049 nfs
    100003 2 tcp 2049 nfs
    100003 3 tcp 2049 nfs
    100003 4 tcp 2049 nfs
    ...which I am missing. What to do?
  3. #3
    SeijiSensei's Avatar
    SeijiSensei is online nowMononoke
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    10,208
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: mount.nfs: Connection timed out

    Usually the command to run the NFS server on Debian/Ubuntu is either "service nfs-kernel-server start" or "/etc/init.d/nfs-kernel-server start".
  4. #4
    Valpskott is offlineA Carafe of Ubuntu
    Join Date
    Oct 2008
    Location
    Sweden
    Beans
    85
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: mount.nfs: Connection timed out

    Dude, I remembered trying that before (a couple of software-reinstalments ago), and it didn't work, it said the server was already running.

    For whatever reason, this time it said it started (tried it so I could hand you the same error-message). I tried mounting it... BAM!! it worked!

    You sir, have made me one happy man! Thank you, thank you, thank you! 
  5. #5
    mdgmnas is offlineFirst Cup of Ubuntu
    Join Date
    Jan 2012
    Beans
    2

    Re: mount.nfs: Connection timed out

    Would suggest you do a
    Code:
    vi /etc/default/services
    and set "NFS=1" (no quotes). This should mean that NFS is automatically started on each boot.

    The information on NetGear.com should be being corrected.

    ReadyNAS.com has a great community forum and a good comparison chart: http://www.readynas.com/?cat=49
  6. #6
    mdgmnas is offlineFirst Cup of Ubuntu
    Join Date
    Jan 2012
    Beans
    2

    Re: mount.nfs: Connection timed out


Wednesday, August 26, 2015

UBUNTU SHARED FOLDER Linux to LINUX machines

I want to mount a folder from a Linux machine on another Linux machine. How do I do that? Do I need to update /etc/fstab or /etc/export?
My target is to mount /tmp from the other Linux machine. I have Debian 5.1. 10.45.40.165, that is the IP of the other machine.
For example I tried:
mount -t nfs 10.45.40.165:/tmp /tmp
mount: 10.45.40.165:/tmp failed, reason given by server: Permission denied
shareimprove this question

migrated from serverfault.com Jun 22 '11 at 14:39

This question came from our site for system and network administrators.
1 
Why was this migrated from SF? –  Ignacio Vazquez-Abrams Jun 22 '11 at 14:42
   
@Ignacio Well - the OP most probably is no sysadmin. David, I assumed you have Debian. Correct me if I'm wrong. Anyway, there is no Linux 5.1. –  slhck Jun 22 '11 at 14:44
1 
@slhck, @Darth: If you insist. –  Ignacio Vazquez-Abrams Jun 22 '11 at 14:48
1 
@David: Please post /etc/exports and the output of netstat -plant and iptables -L from the server. –  Ignacio Vazquez-Abrams Jun 22 '11 at 14:48 
1 
@David: have you started an NFS server on the server machine? Is iptables running on the server? –  PeltierJun 22 '11 at 14:50

2 Answers

What you are doing is NFS share. On a Debian system you should install the tools necessary. Lets assume that the client (the machine on which you want to mount the remote folde) and server (the machine where remote folder is)
On server you'll need to install
apt-get install nfs-server portmap nfs-common
in new debian versions
apt-get install nfs-kernel-server portmap nfs-common
On the client you'll need to install:
apt-get install nfs-client nfs-common
My package selection could have more or less what you need but, some combinations will do.
Now what you need to do is put the folders you want to share with remote machine in /etc/exports:
/path_to_tmp_folder/tmp 192.168.0.2(rw,sync,no_subtree_check,no_root_squash)
Then:
exportfs -ra
/etc/init.d/nfs-kernel-server restart
/etc/init.d/portmap restart
Here 192.168.0.2 is the address of your local machine, replace that with your own IP. exports file has the list of machines that can access the shared folder. If your machines don't have firewall restrictions to each other (you can solve this by adding host to /etc/hosts.allow).
Now on your local machine you can use the command:
sudo mount -o soft,intr,rsize=8192,wsize=8192 server_ip:/path_to_tmp_folder/tmp /local_path_to_empty_tmp_folder/tmp
If you want to have automatic mount on boot you need to edit your /etc/fstab file and put the line on your client:
server_ip:/path_to_tmp/tmp /local_empty_folder/tmp nfs rsize=16384,wsize=16384,rw,auto,nolock
This is just an example of settings (copy pased from my own), you need to check nfs help to see what suites you best.
shareimprove this answer
   
any reason why r/wsize is different for the mount approach as opposed to the fstab approach? –  puk Sep 26 '13 at 18:23
   
instead of nfs-server in new versions of debian the nfs-kernel-server should be used. This information is in debian dependency tree. So update of the answer is recommended. –  Dee Aug 2 '14 at 10:21
   
Can you allow a subnet in the exports file? –  nonsensickle Aug 13 '14 at 22:33

sharing files using SAMBA Linux to MICROSOFT WINDOWS



Using Samba to Share Your Linux Folders with Another PC or Virtual Machine

KDE Folder - Windows
Print
by Rob Williams on April 15, 2014 in SoftwareCreating a network share on Linux is quite a bit different than on Windows, but that doesn’t mean that it requires a degree from Tux U. In this article, we take a look at installing and configuring Samba, creating some shares, and then accessing those shares across a variety of platforms.

Introduction, Configuring Samba & Creating Shares

One of the most popular questions long-time Linux users have been asked is, “How do I create a network share that Windows can see?“, and it’s for good reason. Creating a network share in Linux is a simple enough affair, but your knowledge of pulling off the same trick in Redmond’s famed OS might not help too much.
The best solution for sharing Linux folders across a network is a piece of software that’s about as old as Linux itself: Samba. Despite the fact that the tool is designed to cater to Windows’ SMB protocol, it became a Linux stature long ago. Its tagline is “Opening Windows to a Wider World”, and it couldn’t be more apt for what it accomplishes.
Guides for installing and using Samba are a Dogecoin a dozen, so what I’m hoping to accomplish with this one is to make it simple. I’d also like to provide some unusual examples of what can be done with it, including what can be done from within a Windows virtual machine.
Using nano to Edit Samba's Configuration FileSamba Network Shares in Windows 7
Linux shares mapped as network drives in Windows
Samba is a popular Linux tool, and chances are you already have it installed. To see if that’s the case, open up a terminal and test to see if its configuration folder exists:
ls -l /etc/samba
You can also travel to that folder from within a file manager, as it doesn’t require root or sudo to do so.
If a list of files gets printed back, you’re good to roll. Otherwise, you’ll have to install the tool.
Installing Samba will be a simple affair, but because the best method of doing so will differ from distro to distro, I highly encourage you to go to your distro’s website and search for a Samba guide. Personalized guides are the best guides; looking at the wrong one might cause you to skip a step that would have otherwise made the experience a lot better.
In rarer cases, installing Samba might not be enough. A required counterpart is the CIFS (Common Internet File System) kernel module, which in turn requires FUSE (Filesystem in Userspace) support. Chances are good that both of these will be taken care of when following a distro-specific Samba guide. If not, I’d recommend going to a search engine and querying “CIFS (Your Distro)” for more information.

Configuring Samba

After Samba is installed, a default configuration file called smb.conf.default can be found in /etc/samba. This file needs to be copied to the same folder with the name of smb.conf, but before doing this, it’d be worth running the same ls -l /etc/samba command as above to see if your distro has that file there already. If it doesn’t exist, it’s as simple as entering sudo (or sudo -s to retain escalated privileges for the time-being, or su for systems without sudo) and making use of the default file:
cp /etc/samba/smb.conf.default /etc/samba/smb.conf
Here’s a real-world example:
Creating a Samba Configuration File in Linux
Samba’s user configuration is driven from this smb.conf file, so it needs to be edited to create shares. There are a number of graphical tools for accomplishing this, but I recommend editing the file inside of the terminal, using ‘nano’ or ‘vim’. Normally, I try to avoid recommending the terminal to those who prefer GUI, but there’s nothing to be afraid of here – this is all plain text, and straight-forward.
Using nano: The Samba configuration file can be edited (as sudo, sudo -s, or su) with the command nano -w /etc/samba/smb.conf. nano works as a normal text editor, so delete and add away. Once done, hit Ctrl + X; when the save prompt comes up, push Y and then Enter.
In some cases, a share might be able to be created from within a file manager. In KDE, you can right-click a folder, go to its properties, and then its sharing tab:
Creating a Samba Share in KDE
Configuring a Samba share in KDE
If a file manager sharing option isn’t available, and you’d still rather a GUI solution:
  • Go to your OS’ control center, and look for sharing or networking options.
  • Go to a search engine and type in, “(Your Distro) Samba GUI”.
  • Open the smb.conf with a text editor as root (or sudo). Launch the app through the terminal.
The most complicated part about configuring Samba isn’t editing the smb.conf file, it’s understanding all of the options that are provided. Fortunately, the default configuration file includes a ton of examples, so I’d highly recommend perusing through those to get a grasp on things. I’d also recommend editing the workgroup = VALUE option near the top of the file (I use WORKGROUP).
After fiddling with the general configuration options up top, you can scroll to the bottom of the file and lay the groundwork for a new share:
[Share Name]
path = /home/username/Share
option = value

The [Share Name] is the name of the folder that will be viewable after entering the network hostname (eg: \\LINUXPC\Share Name). The path will be the Linux folder that will be accessible after entering this share. As for the options, there are many. As I mentioned above, the smb.conf file itself contains a number of examples; for all others, there’s a huge page over at the official website to take care of the rest. Let’s cover a couple of the more common ones, though.
guest ok = yes
— Guest accounts are OK to use the share; aka: no passwords.
guest only = yes
Only guests may use the share.
writable = yes
— The share will allow files to be written to it.
read only = yes
— Files cannot be written to the share, just read.
force user = username
— Act as this user when accessing the share, even if a different user/pass is provided.
force group = groupname
— Act as this usergroup when accessing the share. username = username, username2, @groupname
— If the password matches one of these users, the share can be accessed.
valid users = username, username2, @groupname
— Like above, but requires users to enter their username.

Here are a couple of example shares I use:

Using Samba to Share Your Linux Folders with Another PC or Virtual Machine

KDE Folder - Windows
Print
by Rob Williams on April 15, 2014 in SoftwareCreating a network share on Linux is quite a bit different than on Windows, but that doesn’t mean that it requires a degree from Tux U. In this article, we take a look at installing and configuring Samba, creating some shares, and then accessing those shares across a variety of platforms.

Introduction, Configuring Samba & Creating Shares

One of the most popular questions long-time Linux users have been asked is, “How do I create a network share that Windows can see?“, and it’s for good reason. Creating a network share in Linux is a simple enough affair, but your knowledge of pulling off the same trick in Redmond’s famed OS might not help too much.
The best solution for sharing Linux folders across a network is a piece of software that’s about as old as Linux itself: Samba. Despite the fact that the tool is designed to cater to Windows’ SMB protocol, it became a Linux stature long ago. Its tagline is “Opening Windows to a Wider World”, and it couldn’t be more apt for what it accomplishes.
Guides for installing and using Samba are a Dogecoin a dozen, so what I’m hoping to accomplish with this one is to make it simple. I’d also like to provide some unusual examples of what can be done with it, including what can be done from within a Windows virtual machine.
Samba Network Shares in Windows 7
Linux shares mapped as network drives in Windows
Samba is a popular Linux tool, and chances are you already have it installed. To see if that’s the case, open up a terminal and test to see if its configuration folder exists:
ls -l /etc/samba
You can also travel to that folder from within a file manager, as it doesn’t require root or sudo to do so.
If a list of files gets printed back, you’re good to roll. Otherwise, you’ll have to install the tool.
Installing Samba will be a simple affair, but because the best method of doing so will differ from distro to distro, I highly encourage you to go to your distro’s website and search for a Samba guide. Personalized guides are the best guides; looking at the wrong one might cause you to skip a step that would have otherwise made the experience a lot better.
In rarer cases, installing Samba might not be enough. A required counterpart is the CIFS (Common Internet File System) kernel module, which in turn requires FUSE (Filesystem in Userspace) support. Chances are good that both of these will be taken care of when following a distro-specific Samba guide. If not, I’d recommend going to a search engine and querying “CIFS (Your Distro)” for more information.

Configuring Samba

After Samba is installed, a default configuration file called smb.conf.default can be found in /etc/samba. This file needs to be copied to the same folder with the name of smb.conf, but before doing this, it’d be worth running the same ls -l /etc/samba command as above to see if your distro has that file there already. If it doesn’t exist, it’s as simple as entering sudo (or sudo -s to retain escalated privileges for the time-being, or su for systems without sudo) and making use of the default file:
cp /etc/samba/smb.conf.default /etc/samba/smb.conf
Here’s a real-world example:
Creating a Samba Configuration File in Linux
Samba’s user configuration is driven from this smb.conf file, so it needs to be edited to create shares. There are a number of graphical tools for accomplishing this, but I recommend editing the file inside of the terminal, using ‘nano’ or ‘vim’. Normally, I try to avoid recommending the terminal to those who prefer GUI, but there’s nothing to be afraid of here – this is all plain text, and straight-forward.
Using nano: The Samba configuration file can be edited (as sudo, sudo -s, or su) with the command nano -w /etc/samba/smb.conf. nano works as a normal text editor, so delete and add away. Once done, hit Ctrl + X; when the save prompt comes up, push Y and then Enter.
In some cases, a share might be able to be created from within a file manager. In KDE, you can right-click a folder, go to its properties, and then its sharing tab:
Creating a Samba Share in KDE
Configuring a Samba share in KDE
If a file manager sharing option isn’t available, and you’d still rather a GUI solution:
  • Go to your OS’ control center, and look for sharing or networking options.
  • Go to a search engine and type in, “(Your Distro) Samba GUI”.
  • Open the smb.conf with a text editor as root (or sudo). Launch the app through the terminal.
The most complicated part about configuring Samba isn’t editing the smb.conf file, it’s understanding all of the options that are provided. Fortunately, the default configuration file includes a ton of examples, so I’d highly recommend perusing through those to get a grasp on things. I’d also recommend editing the workgroup = VALUE option near the top of the file (I use WORKGROUP).
After fiddling with the general configuration options up top, you can scroll to the bottom of the file and lay the groundwork for a new share:
[Share Name]
path = /home/username/Share
option = value

The [Share Name] is the name of the folder that will be viewable after entering the network hostname (eg: \\LINUXPC\Share Name). The path will be the Linux folder that will be accessible after entering this share. As for the options, there are many. As I mentioned above, the smb.conf file itself contains a number of examples; for all others, there’s a huge page over at the official website to take care of the rest. Let’s cover a couple of the more common ones, though.
guest ok = yes
— Guest accounts are OK to use the share; aka: no passwords.
guest only = yes
Only guests may use the share.
writable = yes
— The share will allow files to be written to it.
read only = yes
— Files cannot be written to the share, just read.
force user = username
— Act as this user when accessing the share, even if a different user/pass is provided.
force group = groupname
— Act as this usergroup when accessing the share. username = username, username2, @groupname
— If the password matches one of these users, the share can be accessed.
valid users = username, username2, @groupname
— Like above, but requires users to enter their username.

Here are a couple of example shares I use:
Using nano to Edit Samba's Configuration File
The “force user” and “force group” options are not go-to options, so I’d recommend tryin

Using Samba to Share Your Linux Folders with Another PC or Virtual Machine

KDE Folder - Windows
Print
by Rob Williams on April 15, 2014 in SoftwareCreating a network share on Linux is quite a bit different than on Windows, but that doesn’t mean that it requires a degree from Tux U. In this article, we take a look at installing and configuring Samba, creating some shares, and then accessing those shares across a variety of platforms.

Introduction, Configuring Samba & Creating Shares

One of the most popular questions long-time Linux users have been asked is, “How do I create a network share that Windows can see?“, and it’s for good reason. Creating a network share in Linux is a simple enough affair, but your knowledge of pulling off the same trick in Redmond’s famed OS might not help too much.
The best solution for sharing Linux folders across a network is a piece of software that’s about as old as Linux itself: Samba. Despite the fact that the tool is designed to cater to Windows’ SMB protocol, it became a Linux stature long ago. Its tagline is “Opening Windows to a Wider World”, and it couldn’t be more apt for what it accomplishes.
Guides for installing and using Samba are a Dogecoin a dozen, so what I’m hoping to accomplish with this one is to make it simple. I’d also like to provide some unusual examples of what can be done with it, including what can be done from within a Windows virtual machine.
Samba Network Shares in Windows 7
Linux shares mapped as network drives in Windows
Samba is a popular Linux tool, and chances are you already have it installed. To see if that’s the case, open up a terminal and test to see if its configuration folder exists:
ls -l /etc/samba
You can also travel to that folder from within a file manager, as it doesn’t require root or sudo to do so.
If a list of files gets printed back, you’re good to roll. Otherwise, you’ll have to install the tool.
Installing Samba will be a simple affair, but because the best method of doing so will differ from distro to distro, I highly encourage you to go to your distro’s website and search for a Samba guide. Personalized guides are the best guides; looking at the wrong one might cause you to skip a step that would have otherwise made the experience a lot better.
In rarer cases, installing Samba might not be enough. A required counterpart is the CIFS (Common Internet File System) kernel module, which in turn requires FUSE (Filesystem in Userspace) support. Chances are good that both of these will be taken care of when following a distro-specific Samba guide. If not, I’d recommend going to a search engine and querying “CIFS (Your Distro)” for more information.

Configuring Samba

After Samba is installed, a default configuration file called smb.conf.default can be found in /etc/samba. This file needs to be copied to the same folder with the name of smb.conf, but before doing this, it’d be worth running the same ls -l /etc/samba command as above to see if your distro has that file there already. If it doesn’t exist, it’s as simple as entering sudo (or sudo -s to retain escalated privileges for the time-being, or su for systems without sudo) and making use of the default file:
cp /etc/samba/smb.conf.default /etc/samba/smb.conf
Here’s a real-world example:
Creating a Samba Configuration File in Linux
Samba’s user configuration is driven from this smb.conf file, so it needs to be edited to create shares. There are a number of graphical tools for accomplishing this, but I recommend editing the file inside of the terminal, using ‘nano’ or ‘vim’. Normally, I try to avoid recommending the terminal to those who prefer GUI, but there’s nothing to be afraid of here – this is all plain text, and straight-forward.
Using nano: The Samba configuration file can be edited (as sudo, sudo -s, or su) with the command nano -w /etc/samba/smb.conf. nano works as a normal text editor, so delete and add away. Once done, hit Ctrl + X; when the save prompt comes up, push Y and then Enter.
In some cases, a share might be able to be created from within a file manager. In KDE, you can right-click a folder, go to its properties, and then its sharing tab:
Creating a Samba Share in KDE
Configuring a Samba share in KDE
If a file manager sharing option isn’t available, and you’d still rather a GUI solution:
  • Go to your OS’ control center, and look for sharing or networking options.
  • Go to a search engine and type in, “(Your Distro) Samba GUI”.
  • Open the smb.conf with a text editor as root (or sudo). Launch the app through the terminal.
The most complicated part about configuring Samba isn’t editing the smb.conf file, it’s understanding all of the options that are provided. Fortunately, the default configuration file includes a ton of examples, so I’d highly recommend perusing through those to get a grasp on things. I’d also recommend editing the workgroup = VALUE option near the top of the file (I use WORKGROUP).
After fiddling with the general configuration options up top, you can scroll to the bottom of the file and lay the groundwork for a new share:
[Share Name]
path = /home/username/Share
option = value

The [Share Name] is the name of the folder that will be viewable after entering the network hostname (eg: \\LINUXPC\Share Name). The path will be the Linux folder that will be accessible after entering this share. As for the options, there are many. As I mentioned above, the smb.conf file itself contains a number of examples; for all others, there’s a huge page over at the official website to take care of the rest. Let’s cover a couple of the more common ones, though.
guest ok = yes
— Guest accounts are OK to use the share; aka: no passwords.
guest only = yes
Only guests may use the share.
writable = yes
— The share will allow files to be written to it.
read only = yes
— Files cannot be written to the share, just read.
force user = username
— Act as this user when accessing the share, even if a different user/pass is provided.
force group = groupname
— Act as this usergroup when accessing the share. username = username, username2, @groupname
— If the password matches one of these users, the share can be accessed.
valid users = username, username2, @groupname
— Like above, but requires users to enter their username.

Here are a couple of example shares I use:
Using nano to Edit Samba's Configuration File


Using Samba to Share Your Linux Folders with Another PC or Virtual Machine

KDE Folder - Windows
Print
by Rob Williams on April 15, 2014 in SoftwareCreating a network share on Linux is quite a bit different than on Windows, but that doesn’t mean that it requires a degree from Tux U. In this article, we take a look at installing and configuring Samba, creating some shares, and then accessing those shares across a variety of platforms.

Introduction, Configuring Samba & Creating Shares

One of the most popular questions long-time Linux users have been asked is, “How do I create a network share that Windows can see?“, and it’s for good reason. Creating a network share in Linux is a simple enough affair, but your knowledge of pulling off the same trick in Redmond’s famed OS might not help too much.
The best solution for sharing Linux folders across a network is a piece of software that’s about as old as Linux itself: Samba. Despite the fact that the tool is designed to cater to Windows’ SMB protocol, it became a Linux stature long ago. Its tagline is “Opening Windows to a Wider World”, and it couldn’t be more apt for what it accomplishes.
Guides for installing and using Samba are a Dogecoin a dozen, so what I’m hoping to accomplish with this one is to make it simple. I’d also like to provide some unusual examples of what can be done with it, including what can be done from within a Windows virtual machine.
Samba Network Shares in Windows 7
Linux shares mapped as network drives in Windows
Samba is a popular Linux tool, and chances are you already have it installed. To see if that’s the case, open up a terminal and test to see if its configuration folder exists:
ls -l /etc/samba
You can also travel to that folder from within a file manager, as it doesn’t require root or sudo to do so.
If a list of files gets printed back, you’re good to roll. Otherwise, you’ll have to install the tool.
Installing Samba will be a simple affair, but because the best method of doing so will differ from distro to distro, I highly encourage you to go to your distro’s website and search for a Samba guide. Personalized guides are the best guides; looking at the wrong one might cause you to skip a step that would have otherwise made the experience a lot better.
In rarer cases, installing Samba might not be enough. A required counterpart is the CIFS (Common Internet File System) kernel module, which in turn requires FUSE (Filesystem in Userspace) support. Chances are good that both of these will be taken care of when following a distro-specific Samba guide. If not, I’d recommend going to a search engine and querying “CIFS (Your Distro)” for more information.

Configuring Samba

After Samba is installed, a default configuration file called smb.conf.default can be found in /etc/samba. This file needs to be copied to the same folder with the name of smb.conf, but before doing this, it’d be worth running the same ls -l /etc/samba command as above to see if your distro has that file there already. If it doesn’t exist, it’s as simple as entering sudo (or sudo -s to retain escalated privileges for the time-being, or su for systems without sudo) and making use of the default file:
cp /etc/samba/smb.conf.default /etc/samba/smb.conf
Here’s a real-world example:
Creating a Samba Configuration File in Linux
Samba’s user configuration is driven from this smb.conf file, so it needs to be edited to create shares. There are a number of graphical tools for accomplishing this, but I recommend editing the file inside of the terminal, using ‘nano’ or ‘vim’. Normally, I try to avoid recommending the terminal to those who prefer GUI, but there’s nothing to be afraid of here – this is all plain text, and straight-forward.
Using nano: The Samba configuration file can be edited (as sudo, sudo -s, or su) with the command nano -w /etc/samba/smb.conf. nano works as a normal text editor, so delete and add away. Once done, hit Ctrl + X; when the save prompt comes up, push Y and then Enter.
In some cases, a share might be able to be created from within a file manager. In KDE, you can right-click a folder, go to its properties, and then its sharing tab:
Creating a Samba Share in KDE
Configuring a Samba share in KDE
If a file manager sharing option isn’t available, and you’d still rather a GUI solution:
  • Go to your OS’ control center, and look for sharing or networking options.
  • Go to a search engine and type in, “(Your Distro) Samba GUI”.
  • Open the smb.conf with a text editor as root (or sudo). Launch the app through the terminal.
The most complicated part about configuring Samba isn’t editing the smb.conf file, it’s understanding all of the options that are provided. Fortunately, the default configuration file includes a ton of examples, so I’d highly recommend perusing through those to get a grasp on things. I’d also recommend editing the workgroup = VALUE option near the top of the file (I use WORKGROUP).
After fiddling with the general configuration options up top, you can scroll to the bottom of the file and lay the groundwork for a new share:
[Share Name]
path = /home/username/Share
option = value

The [Share Name] is the name of the folder that will be viewable after entering the network hostname (eg: \\LINUXPC\Share Name). The path will be the Linux folder that will be accessible after entering this share. As for the options, there are many. As I mentioned above, the smb.conf file itself contains a number of examples; for all others, there’s a huge page over at the official website to take care of the rest. Let’s cover a couple of the more common ones, though.
guest ok = yes
— Guest accounts are OK to use the share; aka: no passwords.
guest only = yes
Only guests may use the share.
writable = yes
— The share will allow files to be written to it.
read only = yes
— Files cannot be written to the share, just read.
force user = username
— Act as this user when accessing the share, even if a different user/pass is provided.
force group = groupname
— Act as this usergroup when accessing the share. username = username, username2, @groupname
— If the password matches one of these users, the share can be accessed.
valid users = username, username2, @groupname
— Like above, but requires users to enter their username.

Here are a couple of example shares I use:

Using Samba to Share Your Linux Folders with Another PC or Virtual Machine

KDE Folder - Windows
Print
by Rob Williams on April 15, 2014 in SoftwareCreating a network share on Linux is quite a bit different than on Windows, but that doesn’t mean that it requires a degree from Tux U. In this article, we take a look at installing and configuring Samba, creating some shares, and then accessing those shares across a variety of platforms.

Introduction, Configuring Samba & Creating Shares

One of the most popular questions long-time Linux users have been asked is, “How do I create a network share that Windows can see?“, and it’s for good reason. Creating a network share in Linux is a simple enough affair, but your knowledge of pulling off the same trick in Redmond’s famed OS might not help too much.
The best solution for sharing Linux folders across a network is a piece of software that’s about as old as Linux itself: Samba. Despite the fact that the tool is designed to cater to Windows’ SMB protocol, it became a Linux stature long ago. Its tagline is “Opening Windows to a Wider World”, and it couldn’t be more apt for what it accomplishes.
Guides for installing and using Samba are a Dogecoin a dozen, so what I’m hoping to accomplish with this one is to make it simple. I’d also like to provide some unusual examples of what can be done with it, including what can be done from within a Windows virtual machine.
Samba Network Shares in Windows 7
Linux shares mapped as network drives in Windows
Samba is a popular Linux tool, and chances are you already have it installed. To see if that’s the case, open up a terminal and test to see if its configuration folder exists:
ls -l /etc/samba
You can also travel to that folder from within a file manager, as it doesn’t require root or sudo to do so.
If a list of files gets printed back, you’re good to roll. Otherwise, you’ll have to install the tool.
Installing Samba will be a simple affair, but because the best method of doing so will differ from distro to distro, I highly encourage you to go to your distro’s website and search for a Samba guide. Personalized guides are the best guides; looking at the wrong one might cause you to skip a step that would have otherwise made the experience a lot better.
In rarer cases, installing Samba might not be enough. A required counterpart is the CIFS (Common Internet File System) kernel module, which in turn requires FUSE (Filesystem in Userspace) support. Chances are good that both of these will be taken care of when following a distro-specific Samba guide. If not, I’d recommend going to a search engine and querying “CIFS (Your Distro)” for more information.

Configuring Samba

After Samba is installed, a default configuration file called smb.conf.default can be found in /etc/samba. This file needs to be copied to the same folder with the name of smb.conf, but before doing this, it’d be worth running the same ls -l /etc/samba command as above to see if your distro has that file there already. If it doesn’t exist, it’s as simple as entering sudo (or sudo -s to retain escalated privileges for the time-being, or su for systems without sudo) and making use of the default file:
cp /etc/samba/smb.conf.default /etc/samba/smb.conf
Here’s a real-world example:
Creating a Samba Configuration File in Linux
Samba’s user configuration is driven from this smb.conf file, so it needs to be edited to create shares. There are a number of graphical tools for accomplishing this, but I recommend editing the file inside of the terminal, using ‘nano’ or ‘vim’. Normally, I try to avoid recommending the terminal to those who prefer GUI, but there’s nothing to be afraid of here – this is all plain text, and straight-forward.
Using nano: The Samba configuration file can be edited (as sudo, sudo -s, or su) with the command nano -w /etc/samba/smb.conf. nano works as a normal text editor, so delete and add away. Once done, hit Ctrl + X; when the save prompt comes up, push Y and then Enter.
In some cases, a share might be able to be created from within a file manager. In KDE, you can right-click a folder, go to its properties, and then its sharing tab:
Creating a Samba Share in KDE
Configuring a Samba share in KDE
If a file manager sharing option isn’t available, and you’d still rather a GUI solution:
  • Go to your OS’ control center, and look for sharing or networking options.
  • Go to a search engine and type in, “(Your Distro) Samba GUI”.
  • Open the smb.conf with a text editor as root (or sudo). Launch the app through the terminal.
The most complicated part about configuring Samba isn’t editing the smb.conf file, it’s understanding all of the options that are provided. Fortunately, the default configuration file includes a ton of examples, so I’d highly recommend perusing through those to get a grasp on things. I’d also recommend editing the workgroup = VALUE option near the top of the file (I use WORKGROUP).
After fiddling with the general configuration options up top, you can scroll to the bottom of the file and lay the groundwork for a new share:
[Share Name]
path = /home/username/Share
option = value

The [Share Name] is the name of the folder that will be viewable after entering the network hostname (eg: \\LINUXPC\Share Name). The path will be the Linux folder that will be accessible after entering this share. As for the options, there are many. As I mentioned above, the smb.conf file itself contains a number of examples; for all others, there’s a huge page over at the official website to take care of the rest. Let’s cover a couple of the more common ones, though.
guest ok = yes
— Guest accounts are OK to use the share; aka: no passwords.
guest only = yes
Only guests may use the share.
writable = yes
— The share will allow files to be written to it.
read only = yes
— Files cannot be written to the share, just read.
force user = username
— Act as this user when accessing the share, even if a different user/pass is provided.
force group = groupname
— Act as this usergroup when accessing the share. username = username, username2, @groupname
— If the password matches one of these users, the share can be accessed.
valid users = username, username2, @groupname
— Like above, but requires users to enter their username.

Here are a couple of example shares I use:
Using nano to Edit Samba's Configuration File
The “force user” and “force group” options are not go-to options, so I’d recommend trying to create a share without them first. In some cases, permission issues will prevent you from writing to certain folders, a situation I found myself in where my NAS mounts and desktop folder were concerned. If worse comes to worse, simply add these force options and retest.
Each time the smb.conf file is edited, Samba should be restarted to reflect the changes. On most distros, running this command as sudo (or su) should take care of it:
/etc/init.d/samba restart
For Ubuntu-based distros, the service command might need to be used. As sudo:
service smbd restart
If neither of these commands work, refer to your distro’s documentation.
With Samba all configured, let’s connect to our shares!



Using Samba to Share Your Linux Folders with Another PC or Virtual Machine

KDE Folder - Windows
Print
by Rob Williams on April 15, 2014 in SoftwareCreating a network share on Linux is quite a bit different than on Windows, but that doesn’t mean that it requires a degree from Tux U. In this article, we take a look at installing and configuring Samba, creating some shares, and then accessing those shares across a variety of platforms.

Introduction, Configuring Samba & Creating Shares

One of the most popular questions long-time Linux users have been asked is, “How do I create a network share that Windows can see?“, and it’s for good reason. Creating a network share in Linux is a simple enough affair, but your knowledge of pulling off the same trick in Redmond’s famed OS might not help too much.
The best solution for sharing Linux folders across a network is a piece of software that’s about as old as Linux itself: Samba. Despite the fact that the tool is designed to cater to Windows’ SMB protocol, it became a Linux stature long ago. Its tagline is “Opening Windows to a Wider World”, and it couldn’t be more apt for what it accomplishes.
Guides for installing and using Samba are a Dogecoin a dozen, so what I’m hoping to accomplish with this one is to make it simple. I’d also like to provide some unusual examples of what can be done with it, including what can be done from within a Windows virtual machine.
Samba Network Shares in Windows 7
Linux shares mapped as network drives in Windows
Samba is a popular Linux tool, and chances are you already have it installed. To see if that’s the case, open up a terminal and test to see if its configuration folder exists:
ls -l /etc/samba
You can also travel to that folder from within a file manager, as it doesn’t require root or sudo to do so.
If a list of files gets printed back, you’re good to roll. Otherwise, you’ll have to install the tool.
Installing Samba will be a simple affair, but because the best method of doing so will differ from distro to distro, I highly encourage you to go to your distro’s website and search for a Samba guide. Personalized guides are the best guides; looking at the wrong one might cause you to skip a step that would have otherwise made the experience a lot better.
In rarer cases, installing Samba might not be enough. A required counterpart is the CIFS (Common Internet File System) kernel module, which in turn requires FUSE (Filesystem in Userspace) support. Chances are good that both of these will be taken care of when following a distro-specific Samba guide. If not, I’d recommend going to a search engine and querying “CIFS (Your Distro)” for more information.

Configuring Samba

After Samba is installed, a default configuration file called smb.conf.default can be found in /etc/samba. This file needs to be copied to the same folder with the name of smb.conf, but before doing this, it’d be worth running the same ls -l /etc/samba command as above to see if your distro has that file there already. If it doesn’t exist, it’s as simple as entering sudo (or sudo -s to retain escalated privileges for the time-being, or su for systems without sudo) and making use of the default file:
cp /etc/samba/smb.conf.default /etc/samba/smb.conf
Here’s a real-world example:
Creating a Samba Configuration File in Linux
Samba’s user configuration is driven from this smb.conf file, so it needs to be edited to create shares. There are a number of graphical tools for accomplishing this, but I recommend editing the file inside of the terminal, using ‘nano’ or ‘vim’. Normally, I try to avoid recommending the terminal to those who prefer GUI, but there’s nothing to be afraid of here – this is all plain text, and straight-forward.
Using nano: The Samba configuration file can be edited (as sudo, sudo -s, or su) with the command nano -w /etc/samba/smb.conf. nano works as a normal text editor, so delete and add away. Once done, hit Ctrl + X; when the save prompt comes up, push Y and then Enter.
In some cases, a share might be able to be created from within a file manager. In KDE, you can right-click a folder, go to its properties, and then its sharing tab:
Creating a Samba Share in KDE
Configuring a Samba share in KDE
If a file manager sharing option isn’t available, and you’d still rather a GUI solution:
  • Go to your OS’ control center, and look for sharing or networking options.
  • Go to a search engine and type in, “(Your Distro) Samba GUI”.
  • Open the smb.conf with a text editor as root (or sudo). Launch the app through the terminal.
The most complicated part about configuring Samba isn’t editing the smb.conf file, it’s understanding all of the options that are provided. Fortunately, the default configuration file includes a ton of examples, so I’d highly recommend perusing through those to get a grasp on things. I’d also recommend editing the workgroup = VALUE option near the top of the file (I use WORKGROUP).
After fiddling with the general configuration options up top, you can scroll to the bottom of the file and lay the groundwork for a new share:
[Share Name]
path = /home/username/Share
option = value

The [Share Name] is the name of the folder that will be viewable after entering the network hostname (eg: \\LINUXPC\Share Name). The path will be the Linux folder that will be accessible after entering this share. As for the options, there are many. As I mentioned above, the smb.conf file itself contains a number of examples; for all others, there’s a huge page over at the official website to take care of the rest. Let’s cover a couple of the more common ones, though.
guest ok = yes
— Guest accounts are OK to use the share; aka: no passwords.
guest only = yes
Only guests may use the share.
writable = yes
— The share will allow files to be written to it.
read only = yes
— Files cannot be written to the share, just read.
force user = username
— Act as this user when accessing the share, even if a different user/pass is provided.
force group = groupname
— Act as this usergroup when accessing the share. username = username, username2, @groupname
— If the password matches one of these users, the share can be accessed.
valid users = username, username2, @groupname
— Like above, but requires users to enter their username.

Here are a couple of example shares I use:
Using nano to Edit Samba's Configuration File
The “force user” and “force group” options are not go-to options, so I’d recommend trying to create a share without them first. In some cases, permission issues will prevent you from writing to certain folders, a situation I found myself in where my NAS mounts and desktop folder were concerned. If worse comes to worse, simply add these force options and retest.
Each time the smb.conf file is edited, Samba should be restarted to reflect the changes. On most distros, running this command as sudo (or su) should take care of it:
/etc/init.d/samba restart
For Ubuntu-based distros, the service command might need to be used. As sudo:
service smbd restart
If neither of these commands work, refer to your distro’s documentation.
With Samba all configured, let’s connect to our shares!

The “force user” and “force group” options are not go-to options, so I’d recommend trying to create a share without them first. In some cases, permission issues will prevent you from writing to certain folders, a situation I found myself in where my NAS mounts and desktop folder were concerned. If worse comes to worse, simply add these force options and retest.
Each time the smb.conf file is edited, Samba should be restarted to reflect the changes. On most distros, running this command as sudo (or su) should take care of it:
/etc/init.d/samba restart
For Ubuntu-based distros, the service command might need to be used. As sudo:
service smbd restart
If neither of these commands work, refer to your distro’s documentation.
With Samba all configured, let’s connect to our shares!

The “force user” and “force group” options are not go-to options, so I’d recommend trying to create a share without them first. In some cases, permission issues will prevent you from writing to certain folders, a situation I found myself in where my NAS mounts and desktop folder were concerned. If worse comes to worse, simply add these force options and retest.
Each time the smb.conf file is edited, Samba should be restarted to reflect the changes. On most distros, running this command as sudo (or su) should take care of it:
/etc/init.d/samba restart
For Ubuntu-based distros, the service command might need to be used. As sudo:
service smbd restart
If neither of these commands work, refer to your distro’s documentation.
With Samba all configured, let’s connect to our shares!

g to create a share without them first. In some cases, permission issues will prevent you from writing to certain folders, a situation I found myself in where my NAS mounts and desktop folder were concerned. If worse comes to worse, simply add these force options and retest.
Each time the smb.conf file is edited, Samba should be restarted to reflect the changes. On most distros, running this command as sudo (or su) should take care of it:
/etc/init.d/samba restart
For Ubuntu-based distros, the service command might need to be used. As sudo:
service smbd restart
If neither of these commands work, refer to your distro’s documentation.
With Samba all configured, let’s connect to our shares!


The “force user” and “force group” options are not go-to options, so I’d recommend trying to create a share without them first. In some cases, permission issues will prevent you from writing to certain folders, a situation I found myself in where my NAS mounts and desktop folder were concerned. If worse comes to worse, simply add these force options and retest.
Each time the smb.conf file is edited, Samba should be restarted to reflect the changes. On most distros, running this command as sudo (or su) should take care of it:
/etc/init.d/samba restart
For Ubuntu-based distros, the service command might need to be used. As sudo:
service smbd restart
If neither of these commands work, refer to your distro’s documentation.
With Samba all configured, let’s connect to our shares!