Samba server

770 views
658 views

Published on

Linux samba configer

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
770
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
57
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Samba server

  1. 1. 1 Preliminary NoteIm using a CentOS 5.6 system here with the hostname server1.example.com and the IP address192.168.0.100.Please make sure that SELinux is disabled as shown in chapter 6 of this tutorial: The Perfect Server -CentOS 5.6 x86_64 [ISPConfig 2] - Page 32 Installing SambaConnect to your server on the shell and install the Samba packages:yum install cups-libs samba samba-commonEdit the smb.conf file:vi /etc/samba/smb.confMake sure you see the following lines in the [global] section: [...] # Backend to store user information in. New installations should # use either tdbsam or ldapsam. smbpasswd is available for backwards # compatibility. tdbsam requires no further configuration. security = user passdb backend = tdbsam [...]This enables Linux system users to log in to the Samba server.Then create the system startup links for Samba and start it:chkconfig --levels 235 smb on/etc/init.d/smb start3 Adding Samba SharesNow I will add a share that is accessible by all users.Create the directory for sharing the files and change the group to the users group:mkdir -p /home/shares/alluserschown -R root:users /home/shares/allusers/chmod -R ug+rwx,o+rx-w /home/shares/allusers/At the end of the file /etc/samba/smb.conf add the following lines:
  2. 2. vi /etc/samba/smb.conf [...] [allusers] comment = All Users path = /home/shares/allusers valid users = @users force group = users create mask = 0660 directory mask = 0771 writable = yesIf you want all users to be able to read and write to their home directories via Samba, add the followinglines to /etc/samba/smb.conf (make sure you comment out or remove the other [homes] section in thesmb.conf file!): [...] [homes] comment = Home Directories browseable = no valid users = %S writable = yes create mask = 0700 directory mask = 0700Now we restart Samba:/etc/init.d/smb restart4 Adding And Managing UsersIn this example, I will add a user named tom. You can add as many users as you need in the same way,just replace the username tom with the desired username in the commands.useradd tom -m -G usersSet a password for tom in the Linux system user database. If the user tom should not be able to log intothe Linux system, skip this step.passwd tom-> Enter the password for the new user.Now add the user to the Samba user database:smbpasswd -a tom-> Enter the password for the new user.Now you should be able to log in from your Windows workstation with the file explorer (addressis 192.168.0.100 or 192.168.0.100tom for toms home directory) using the username tom and thechosen password and store files on the Linux server either in toms home directory or in the publicshared directory.
  3. 3. Step # 1: Add a user joe to UNIX/Linux systemadduser command adds user to the system according to command line options and configurationinformation in /etc/adduser.conf. They are friendlier front ends to the low level tools like useradd.Type any one of the following command:# useradd joe# passwd joeORadduser joeStep # 2: Add a user to sambaNow user joe has account on Linux/UNIX box. Use smbpasswd command to specifies that theusername following should be added to the local smbpasswd file:# smbpasswd -a joeStep # 3: Add a user to a Samab shareBy default user gets access to /home/joe from windows system. Let us say you want to give joe accessto /data/accounts (make sure directory /data/accounts exists) directory. Open /etc/samba/smb.conf fileand add/modify share called [accounts]:[accounts]comment = Accounts data directorypath = /data/accountsvalid users = vivek raj joepublic = nowritable = yesSave the file.Step #4: Restart the samba# service smb restartOR# /etc/init.d/smb reload

×