0% found this document useful (0 votes)
8 views3 pages

Create Samba Network Share via CLI

This document provides instructions for creating a network share on Linux using Samba via the command line interface. It explains how to install Samba, set a password for the user in Samba, create a directory to share, edit the smb.conf file to add the share configuration, restart Samba, and then access the shared folder from Windows or Linux machines. The steps are designed to be uncomplicated and brief for easy sharing of files between Windows and Linux systems.

Uploaded by

MiiltonGarcía
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Create Samba Network Share via CLI

This document provides instructions for creating a network share on Linux using Samba via the command line interface. It explains how to install Samba, set a password for the user in Samba, create a directory to share, edit the smb.conf file to add the share configuration, restart Samba, and then access the shared folder from Windows or Linux machines. The steps are designed to be uncomplicated and brief for easy sharing of files between Windows and Linux systems.

Uploaded by

MiiltonGarcía
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

HowtoCreateaNetworkShareViaSambaViaCLI

(Commandlineinterface/LinuxTerminal)
Uncomplicated,SimpleandBriefWay!
HowtoCreateaNetworkShareViaSambaViaCLI(Commandline
interface/LinuxTerminal)Uncomplicated,SimpleandBriefWay!
AboutThisGuide
Inthistext,IteachhowtocreateanetworkshareviaSambausingtheCLI(Commandline
interface/LinuxTerminal)inanuncomplicated,simpleandbriefwaytargetingWindowsusers.

Procedures
Allcommandsmustbedoneasroot(precedeeachcommandwith'sudo'oruse'sudosu').
InstallSamba
sudoaptgetupdate
sudoaptgetinstallsamba
SetapasswordforyouruserinSamba
sudosmbpasswda<user_name>

Note:SambausesaseparatesetofpasswordsthanthestandardLinuxsystem
accounts(storedin/etc/samba/smbpasswd),soyou'llneedtocreateaSamba
[Link]
anditdoesnotcoversituationsinvolvingotheruserspasswords,groups,
etc...

Tip1:Usethepasswordforyourownusertofacilitate.

Tip2:Rememberthatyourusermusthavepermissiontowriteandeditthe
folderyouwanttoshare.
Eg.:
sudochown<user_name>/var/opt/blah/blahblah

sudochown:<user_name>/var/opt/blah/blahblah

Tip3:Ifyou'reusinganotheruserthanyourown,itneedstoexistinyour
systembeforehand,youcancreateitwithoutashellaccessusingthe
followingcommand:
sudouseraddUSERNAMEshell/bin/false
Youcanalsohidetheuserontheloginscreenbyadjustinglightdm's
configuration,in/etc/lightdm/[Link]
line:
hiddenusers=
Createadirectorytobeshared
mkdir/home/<user_name>/<folder_name>
[Link],incaseyoumakeanerror
sudocp/etc/samba/[Link]~
Editthefile"/etc/samba/[Link]"
sudonano/etc/samba/[Link]

Once"[Link]"hasloaded,addthistotheveryendofthefile:
[<folder_name>]
path=/home/<user_name>/<folder_name>
validusers=<user_name>
readonly=no

Tip:ThereShouldbeinthespacesbetweenthelines,andnotequealsothere
shouldbeasinglespacebothbeforeandaftereachoftheequalsigns.
Restartthesamba:
sudoservicesmbdrestart
OnceSambahasrestarted,[Link]
testparm

Toaccessyournetworkshare
sudoaptgetinstallsmbclient
#Listallshares:
smbclientL//<HOST_IP_OR_NAME>/<folder_name>U<user>
#connect:
smbclient//<HOST_IP_OR_NAME>/<folder_name>U<user>
Toaccessyournetworkshareuseyourusername(<user_name>)andpasswordthroughthepath
"smb://<HOST_IP_OR_NAME>/<folder_name>/"(Linuxusers)or"\\<HOST_IP_OR_NAME>\
<folder_name>\"(Windowsusers).Notethat"<folder_name>"valueispassedin"[<folder_name>]",
inotherwords,thesharenameyouenteredin"/etc/samba/[Link]".
Note:Thedefaultusergroupofsambais"WORKGROUP".

You might also like