27 March, 2013

How to add or change ubuntu linux to Workgroup.


Installing Samba

This, of course, is the first step in this process. To install Samba open up a terminal window and issue the command:
$ sudo apt-get install samba cifs-utils ([ubuntu   upto ->14.10] smbfs)
You will need to enter your sudo password for this to work. There might also be dependencies to install, which will be dictated by what you currently have installed on your system. Once complete, you will have the Samba system installed and ready to be configured.

  • Changing the Workgroup - Joining another workgroup (Interoparate with Windows)
  • To change the LinuxMint workgroup, we need to edit the [/etc/samba/smb.conf] file:
$ sudo nano /etc/samba/smb.conf
Look for:
workgroup = WORKGROUP
and change to:
workgroup = MYHOME

change MYHOME to your desired workgroup name.

  1. Create a new section at the bottom of the file, or uncomment one of the examples, for the directory to be shared:
    [share]
        comment = Ubuntu File Server Share
        path = /srv/samba/share
        browsable = yes
        guest ok = yes
        read only = no
        create mask = 0755
    
    • comment: a short description of the share. Adjust to fit your needs.
    • path: the path to the directory to share.
      This example uses /srv/samba/sharename because, according to the Filesystem Hierarchy Standard (FHS)/srv is where site-specific data should be served. Technically Samba shares can be placed anywhere on the filesystem as long as the permissions are correct, but adhering to standards is recommended.
    • browsable: enables Windows clients to browse the shared directory using Windows Explorer.
    • guest ok: allows clients to connect to the share without supplying a password.
    • read only: determines if the share is read only or if write privileges are granted. Write privileges are allowed only when the value isno, as is seen in this example. If the value is yes, then access to the share is read only.
    • create mask: determines the permissions new files will have when created.
  2. Now that Samba is configured, the directory needs to be created and the permissions changed. From a terminal enter:
    sudo mkdir -p /srv/samba/share
    sudo chown nobody:nogroup /srv/samba/share/
    
    The -p switch tells mkdir to create the entire directory tree if it doesn't exist.
  3. Finally, restart the samba services to enable the new configuration:
    sudo systemctl restart smbd.service nmbd.service
    
From a Windows client you should now be able to browse to the Ubuntu file server and see the shared directory. If your client doesn't show your share automatically, try to access your server by its IP address, e.g. \\192.168.1.1, in a Windows Explorer window. To check that everything is working try creating a directory from Windows.
To create additional shares simply create new [dir] sections in /etc/samba/smb.conf, and restart Samba. Just make sure that the directory you want to share actually exists and the permissions are correct.
The file share named "[share]" and the path /srv/samba/share are just examples. Adjust the share and path names to fit your environment. It is a good idea to name a share after a directory on the file system. Another example would be a share name of [qa] with a path of /srv/samba/qa.


No comments: