Walker News

How To Configure Linux Samba File Sharing In 3 Minutes?

It won’t take you more than 3 minutes (perhaps even less than 1 minute) to configure Linux Samba to host a shared folder on Linux system.

Let’s say we want to create two shared folders in RHEL6.3 system, one is called “dump” (allow both write and read access) and the other one called “read$” which appears as read-only, hidden shared folder:

1. Install both samba server and client. Please refer to previous post on how to use Yum to easily install RPM packages on Linux. E.g.:
yum --enablerepo=rhdvd install samba -y
yum --enablerepo=rhdvd install samba-client -y

2. Create a new user account called guestacct:
useradd -d /home/guestacct guestacct

3. Login as guestacct to create “dump” and “read” folders:
su - guestacct
mkdir dump
mkdir read
exit

4. Rename the original smb.conf file and create a new one:
cd /etc/samba
mv smb.conf smb.conf.org
vi smb.conf

5. Paste these lines into the new smb.conf file
[global]
  workgroup = MySambaGrp
  server string = MySamba
  netbios name = MySamba
  security = user
  passdb backend = tdbsam
[dump]
  comment = folder for read and write
  path = /home/guestacct/dump
  writable = yes
[read$]
  comment = read-only, hidden folder
  path = /home/guestacct/read
  writable = no

6. Create a Samba password for Linux user account created step-2:
smbpasswd -a guestacct

7. Start/restart the Linux Samba server to make use of new smb.conf settings:
service smb restart

8. To confirm the shared folder setup is working:
smbclient -L localhost -U%

Using Linux Samba to create hidden shared folder in Linux

Done – how many minutes you need to execute this procedure?

To access the Linux shared folder from Windows, prefix the Samba login ID with “this\”:

Access Linux shared folder from Windows.

To access the Linux shared folder from another Linux:
smbclient //smbsvr/dump -U guestacct

To mount Linux shared folder to /media directory:
mount -t cifs -o user=guestacct //smbsvr/dump /media

It’s kinda long post, but the setup doesn’t take that long!

Custom Search

2016  •  Privacy Policy