Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Thursday, December 20, 2012

Sharing a Folder in Linux Ubuntu 12.04

One of the most common ways to share a folder on Ubuntu system is to configure Samba File Server. These Steps will help to configure Samba server to share files and folders in network.

1. First install the samba package from terminal by typing the following command
sudo apt-get install samba

after completion of successful installation we can share a folder directly by right click on a folder and select share folder option.

If you want to provide a secure access to that folder then we need to change the Samba server configuration file.
The Samba configuration file is located in /etc/samba/smb.conf.
Edit the pairs in the [global] section of /etc/samba/smb.conf file:
  workgroup = EXAMPLE
  ...
  security = user
Uncomment the security parameter which is commented by default and also change EXAMPLE to match your environment.

Create a new section at the bottom of the file like this:

[share]
   comment = Ubuntu File Server Share
   path = /svr/samba/share
   browsable = yes
   guest ok = yes
   read only = no
   create mask = 0755

comment: a short description of the shared file.

path: path to the directory to share.

In this example i use /svr/samba/sharefoldername because, /svr is where site-specific data should be served. 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 users to browse the shared directory and files using Windows Explorer.

guest ok: allow clients to connect to the shared folder without entering a password.

read only: determines if the share folder is read only or if write privileges are granted. if the value is no then write privileges are allowed, if the value is yes then the privileges are set to read only.

create mask: determines the permissions to new files  will have when created.

Now the Samba Server is configured, then we need to create the directory and change the permissions.
Open Terminal and type the following commands:
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.

Finally restart the samba services to enable the new configuration:

sudo restart smbd
sudo restart nmbd

Connecting Ubuntu 12.04 via Remote from Windows

Connecting to the Ubuntu 12.04 Desktop from Windows is a easy way by following below steps. This can be done using XRDP server package installation.

1. Open the Terminal in Ubuntu system and type the below command
sudo apt-get install xrdp
2.  After completion of the installation process, open the Windows 7 system and Go to Start - and click on Remote Desktop Connection

3. Enter computer name or hostname or IP address of  ubuntu system and click on connect

3. When prompted, type your Ubuntu Username and Password to connect

4. Finally the Ubuntu Desktop will appear on your Windows System.

Note: While connecting to the system if you face any problem then type this below commands and try again

cd /home/youruser
echo "gnome-session --session=ubuntu-2d" > .xsession
sudo /etc/init.d/xrdp restart
Or install gnome session fallback

sudo apt-get install gnome-session-fallback