Results 1 to 9 of 9

Thread: HOW TO: Setup Samba Over A Linux Network.

  1. #1
    Join Date
    Oct 2004
    Location
    Rochester, NY
    Beans
    38

    HOW TO: Setup Samba Over A Linux Network.

    hey guys, I wanted to share a folder on my laptop with my desktop (both linux) how do I do it?

  2. #2
    Join Date
    Oct 2004
    Location
    Cupertino, CA
    Beans
    5,092
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: how do I set up linux network shares?

    the most typical way is by configuring a program called samba. It's a Windows File Sharing server/client for Linux. There are plenty of guides on Google about how to do this.


    I recommend that you use SSH. Though technically not a file sharing protocol, it's easy to set up, plus very simple to extend over a larger network. It's the best solution when both systems run Linux. Plus, traffic is encrypted, giving you an extra sense of security, especially if there's untrusted people on your network (or you're going through the internet!)

    First, use apt-get install ssh to install the SSH server. Do this on both systems.

    Open up a file browser (using any folder on the Computer menu). Go to File, select Connect to Server. Choose SSH as the protocol, fill in appropriate login names and such.

  3. #3
    Join Date
    Oct 2004
    Location
    Binary Land, Maryland
    Beans
    632

    Re: how do I set up linux network shares?

    I wouldn't agree with SSH to share files. Thats not the way you would want to go. I would reccomend installing samba / swat. (SWAT is optional)

    First lets begin by setting up SAMBA!

    Installing...
    Code:
    sudo apt-get install samba
    Configuring /etc/smb.conf
    We will be creating a whole new samba config because we are the guru's and it improves validity. .

    1. Rename /etc/smb.conf to /etc/smb.conf.old
    2. Open /etc/smb.conf with your favorite text editor!


    Code:
    ; /etc/smb.conf
    ;
    ; Make sure and restart the server after making changes to this file, ex:
    ; /etc/rc.d/init.d/smb stop
    ; /etc/rc.d/init.d/smb start
    
    [global]
    ; Uncomment this if you want a guest account
    ; guest account = nobody
       log file = /var/log/samba-log.%m
       lock directory = /var/lock/samba
       share modes = yes
    
    [homes]
       comment = Home Directories
       browseable = no
       read only = no
       create mode = 0750
    
    [tmp]
       comment = Temporary file space
       path = /tmp
       read only = no
       public = yes
    NOTE: If your Samba server has more than one ethernet interface, the smbd may bind to the wrong one. If so, you can force it to bind to the intended one by adding a line that looks like this to the [global] section of /etc/smb.conf:

    Code:
    "interfaces = 192.168.1.1/24"
    Replace the IP above with the interfaces IP address. Notice the /24 at the end. This is the subnet default for a CLASS-C network. It may vary depending on your network.

    To share a directory with the public, create a clone of the [tmp] section above by adding something like this to smb.conf:

    Code:
    [public]
       comment = Public Stuff
       path = /home/public
       public = yes
       writable = yes
       printable = no
    To make the above directory readable by the public, but only writable by people in group ubuntu, modify the entry like this:

    Code:
    [public]
       comment = Public Stuff
       path = /home/public
       public = yes
       writable = yes
       printable = no
       write list = @ubuntu
    After this I would reccommend setting up samba for encrypted passwords.
    In the [global] section of /etc/smb.conf, add the following lines:
    Code:
    encrypt passwords = yes
    smb passwd file = /etc/smbpasswd
    NOTE: If your clients and server are using encrypted passwords, you will not be able to browse the available shares on the server until an initial connection has been made with the appropriate authentication.

    This should be all, save and exit.

    Starting SMB Daemons
    Code:
    sudo /usr/sbin/smbd -D && /usr/sbin/nmbd -D
    Accessing Shared Folder on Another Linux Box
    To see which shares are available on a given host, run:
    Code:
    /usr/bin/smbclient -L host
    
    Example:
    /usr/bin/smbclient -L fleixius
    Where 'host' is replaced with the hostname of the samba server on the network. Unless the SMB server has no security configured, it will ask you for a password. This should print back a service page. Where services are what the host can share to you.

    To view the shared folder 'public' on machine 'fleixius' (//fleixius/public) you will need to:
    Code:
    /usr/bin/smbclient service <password>
    
    Example:
    /usr/bin/smbclient ////fleixius/public  mypwd
    Because of shell restrictions you have to escape the backslashes.

    Now once your in the 'smb: \' console. You can type 'h' for a help menu.

    Mounting a Shared Drive
    Using the examples above, lets say we want to mount a folder called "Ubuntu" shared on "fleixius" to a directory of "/home/Ubuntu" on the local box. The typical mount command would be as following:

    Code:
    smbmount "\\\\fleixius\\Ubuntu" -U rtg2t -c 'mount /home/Ubuntu -u 1000 -g 1000'
    Notice -u and -g. UID and GID. Replace those with your values also.

    I hope this helps and solves the problems with samba. Please send feedback!
    Regards,
    FL-ei-|X|-iu-S
    ][ My Blog ][

  4. #4
    Join Date
    Oct 2004
    Location
    Rochester, NY
    Beans
    38

    Re: how do I set up linux network shares?

    k I followed the guide as written but I get this error

    vulcanon@Vulcari:/etc/samba $ sudo /usr/bin/smbclient -L Vulcari
    Password:
    session setup failed: NT_STATUS_LOGON_FAILURE

    gave the correct password too
    Last edited by Vulc; October 28th, 2004 at 05:22 AM.

  5. #5
    Join Date
    Oct 2004
    Location
    R°yken, Norway
    Beans
    35
    Distro
    Ubuntu

    Re: HOW TO: Setup Samba Over A Linux Network.

    Why use samba in a pure linux relation?

    If you don't need user auth, NFS is the solution.

    It's much easyer than samba and you don't get the overhead as with SSH filetransfer.

    Server:
    http://nfs.sourceforge.net/nfs-howto/server.html

    Client:
    http://nfs.sourceforge.net/nfs-howto/client.html

    Regards
    Stian H. Larssen

  6. #6
    Join Date
    Oct 2004
    Location
    R°yken, Norway
    Beans
    35
    Distro
    Ubuntu

    Re: how do I set up linux network shares?

    Quote Originally Posted by Vulc
    k I followed the guide as written but I get this error
    vulcanon@Vulcari:/etc/samba $ sudo /usr/bin/smbclient -L Vulcari
    Password:
    session setup failed: NT_STATUS_LOGON_FAILURE
    gave the correct password too
    Hi.

    Did you add the samba password on the server for the correct user?

    smbpasswd

  7. #7
    Join Date
    Oct 2004
    Location
    Binary Land, Maryland
    Beans
    632

    Re: HOW TO: Setup Samba Over A Linux Network.

    Yes, if a password was set, then enter the password, if not then just push enter.
    Regards,
    FL-ei-|X|-iu-S
    ][ My Blog ][

  8. #8
    Join Date
    Oct 2004
    Location
    Paradise Island, Bahamas
    Beans
    361
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: HOW TO: Setup Samba Over A Linux Network.

    I recommend "nfs" for share folders between native linux machines. Samba works great for Linux to windows. The "nfs" sharers must edit the "/etc/exports" file and the Share-e must mount the drive as defined in the "sharers" export file. You'll need to install "nfs" file utilities on each Linux machine too!

    If your UID is the same on both machines, you can read/write with no problem. In a multi-user environment you may not want everyone to be the same UID number (1000). In that case every user would be set to a different UID (1000, 1001, ...) on his machine and on the server side; in other words, a master list of username to UID would be used throughout the network. Every user would have a unique UID.

    I used to try and use SAMBA for both Linux and Windows machines, but there are too many "gottchas" with the "rights" thing with Samba and a Linux client.I spent too much time "trying" to force SAMBA on linux when "nfs" just works!
    Last edited by emperor; October 28th, 2004 at 06:08 PM.
    linxos.com hllug.org bubbasgeek.com
    100% Linux/BSD @Home: Ubuntu -hp6810,Desktop,Server,MythTV. hpdm4. M0n0WALL -fw/router.

  9. #9
    Join Date
    Oct 2004
    Location
    Cupertino, CA
    Beans
    5,092
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOW TO: Setup Samba Over A Linux Network.

    Funny thing; I've never had issues with Linux-to-Linux SAMBA. Especially with cifs, which supports POSIX extensions on top of smbfs! YAY

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •