You are on page 1of 2

------------Samba---------------------

#yum install samba* -y

[root@server ~]# mkdir /shared

[root@server ~]# ls -ld /shared/


drwxr-xr-x. 2 root root 6 May 11 10:18 /shared/
[root@server ~]# chmod -R 777 /shared/
[root@server ~]# ls -all /shared/
total 0
drwxr-xr-x. 2 root root 6 May 11 10:18 .
dr-xr-xr-x. 19 root root 249 May 11 10:18 ..
[root@server ~]# chown -R nobody:nobody /shared/
[root@server ~]# ls -all /shared/
total 0
drwxr-xr-x. 2 nobody nobody 6 May 11 10:18 .
dr-xr-xr-x. 19 root root 249 May 11 10:18 ..
[root@server ~]# ls -ld /shared/
drwxr-xr-x. 2 nobody nobody 6 May 11 10:18 /shared/

Step 2:-
vim /etc/samba/smb.conf

Add below entry in last


[shared]
comment = Shared Folder
path = /shared
browsable = yes
writable = yes
read only = no
guest ok = yes

:wq

To check config file is correcgt or not:-


[root@server ~]# testparm
Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Weak crypto is allowed by GnuTLS (e.g. NTLM as a compatibility fallback)
Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions


y
# Global parameters
[global]
printcap name = cups
security = USER
workgroup = SAMBA
idmap config * : backend = tdb
cups options = raw

[homes]
browseable = No
comment = Home Directories
inherit acls = Yes
read only = No
valid users = %S %D%w%S

[printers]
browseable = No
comment = All Printers
create mask = 0600
path = /var/tmp
printable = Yes

[print$]
comment = Printer Drivers
create mask = 0664
directory mask = 0775
force group = @printadmin
path = /var/lib/samba/drivers
write list = @printadmin root

[shared]
comment = Shared Folder
guest ok = Yes
path = /shared
read only = No
[root@server ~]#

# smbpasswd -a harry
New SMB password:
Retype new SMB password:
Added user harry.
[root@server ~]# smbclient '\\192.168.80.158\shared' -U harry
Password for [SAMBA\harry]:
Try "help" to get a list of possible commands.
smb: \> ls
. D 0 Thu May 11 10:42:51 2023
.. D 0 Thu May 11 10:18:14 2023
test1 D 0 Thu May 11 10:36:36 2023

14144512 blocks of size 1024. 9052856 blocks available


smb: \> mkdir harry
smb: \> ls
. D 0 Thu May 11 10:44:35 2023
.. D 0 Thu May 11 10:18:14 2023
test1 D 0 Thu May 11 10:36:36 2023
harry D 0 Thu May 11 10:44:35 2023

14144512 blocks of size 1024. 9052856 blocks available


smb: \> quit

Step 5: Access through window


ctrl+ R
type \\192.168.80.158
provide username and password

You might also like