1 .Installing samba via yum
yum -y install samba samba-common samba-client
Configuring samba. Before changing the configure file, back up the original file:
cp /etc/samba/smb.conf /etc/samba/smb.conf.orig
Showing you the basic configuration of samba. In this example we are going to share softwares directory. Only samba user can able to save files in this directory.
vi /etc/samba/smb.conf
Save and exit the configuration file.
2. Create Samba User
After you have install samba sever, yous still can’t login samba server. You will need create a samba user :
$ smbpasswd -a username
‘-a’ switch tell smbpasswd we want to add a new user, username is the user you want to add.If you want use your windows login password to log in to samba server, you can define the password as your windows password here. The problem is that you need change your samba server password accordingly when you change your windows password.
Please take note, username must exist in /etc/passwd file or you will need use ‘useradd’ to create a user in Linux :
$ sudo /usr/sbin/useradd -d /home/username -s /bin/false -n username
This will create a new user with same group name with (told by ‘-n’), but the user can’t login and run any shell command (because you have specfic the login shell is /bin/false by the ‘-s’ switch, if you want allow user to able to login to a shell, replace /bin/false with /bin/sh).
Ok now you have create a new samba user, how about you want delete or disable them? ‘-d’ switch will disable the user to login to samba server:
$ smbpasswd -d username
If you want to delete a user permanently:
$ smbpasswd -x username
3. Configure iptables to allow conection to the samba server
Check to see whether you have port 137,138,139,443 and 445 open for connection. If not open them in iptables.
$ sudo vim /etc/sysconfig/iptables
$ sudo /etc/init.d/iptables restart
4. Start the Samba service
$ sudo /etc/init.d/smb start
$ sudo /sbin/chkconfig smb on
No comments:
Post a Comment