install samba
# apt-get install samba samba-common python-glade2 system-config-samba
config file edit
# nano /etc/samba/smb.cnf
[global] workgroup = WORKGROUP server string = Samba Server %v netbios name = ubuntu security = user map to guest = bad user dns proxy = no #============================ Share Definitions ============================== [Anonymous] path = /samba/anonymous browsable =yes writable = yes guest ok = yes read only = no ------------------------------- # mkdir -p /samba/anonymous #service smbd restart
Check the permission for the shared folder.
root@server1:~# ls -l /samba/
total 4
drwxr-xr-x 2 root root 4096 May 27 18:17 anonymous
root@server1:~#
To allow anonymous user give the permissions as follows;
root@server1:~# cd /samba
root@server1:/samba# chmod -R 0755 anonymous/
root@server1:# chown -R nobody:nogroup anonymous/
root@server1:/samba# ls -l
total 4
drwx-xr-x 2 nobody nogroup root 4096 May 27 18:17 anonymous
root@server1:/samba#
You can cross check the content at server also.
root@server1:/samba# ls -l anonymous/
total 0
-rwxr–r– 1 nobody nogroup 0 May 27 18:30 test_samba.txt
root@server1:/samba#
For this I will create a group smbgrp & user srijan to access the samba server with proper authentication
addgroup smbgrp
adduser srijan -G smbgrp
smbpasswd -a srijan
root@server1:~# smbpasswd -a srijan
New SMB password:
Retype new SMB password:
Added user srijan.
root@server1:~#
Now create the folder viz secured in the /samba folder & give permissions like this
mkdir -p /samba/secured
cd /samba
chmod -R 0770 secured/
Again edit the configuration file as :
nano /etc/samba/smb.conf
[secured] path = /samba/secured valid users = @smbgrp guest ok = no writable = yes browsable = yes ---------------------------------- service smbd restart root@server1:~# testparm Load smb config files from /etc/samba/smb.conf rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384) Processing section "[Anonymous]" Processing section "[secured]" Loaded services file OK. Server role: ROLE_STANDALONE Press enter to see a dump of your service definitions ----------------------------------------- Now at windows machine check the folder now with the proper credentials