Configure Samba server via command line Linux CentOS

Greg Alexander
Greg Alexander used Ask the Experts™
on
I am trying to get samba working on centOS... I installed it via Yum, changed the samba config file to:

[ShareName]
        path = /var/www/html/
        public = no
        writable = yes
        printable = no
        create mask = 0765
        valid users = username

Restarted samba and it did nothing.. the windows network is not seeing the share at all. I realize there is most likely something I am missing but I have always done it with the GUI, but unable to do that this time.. Any pointers?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
add "global section", like this:

[global]
    netbios name = comp1
    server string =
    workgroup = HOME
    security = user
    smb ports = 139

Commented:
and change "public" to "yes"
example2:

[Share]
    create mask = 0660
    directory mask = 0770
    comment =
    path = /home/pilson/Share
    read only = no
    available = yes
    browseable = yes
    writable = yes
    guest ok = yes
    public = yes
    printable = no
    locking = no
    strict locking = no
have u configure how users are going to authenticate themselves to use the Samba share directory?
Acronis in Gartner 2019 MQ for datacenter backup

It is an honor to be featured in Gartner 2019 Magic Quadrant for Datacenter Backup and Recovery Solutions. Gartner’s MQ sets a high standard and earning a place on their grid is a great affirmation that Acronis is delivering on our mission to protect all data, apps, and systems.

Greg AlexanderLead Developer

Author

Commented:
@raysonlee: I don't suppose so, don't care if it is wide open for that matter... I didn't think you could not require a login because windows forced a login

@pilson66: I assume I need to change the values on the global section

[global]
    netbios name = comp1
    server string =
    workgroup = HOME
    security = user
    smb ports = 139

not sure what they need to be... I am noob at this, for instance I have no clue what my netbios name is :(

Commented:
in share section, change "public" from "no" to "yes" and restart samba.
you have to create samba username and passwords for your users,
 useradd -s /bin/true username
 smbpasswd -L -a username
 smbpasswd -L -e username
use the same username and password as Windows so that the users don't have to enter them again when connect to Samba share directory
try use \\ipaddress\sharename instead of server name to make sure it's not DNS / NETBIOS issue
Greg AlexanderLead Developer

Author

Commented:
I disabled iptables and I am now able to see the share but when I am not able to get into them, it seems that the username and password worked but I don't think I am able to browse it so I added browsable = yes and that didn't work :( I wish I could just not allow a login, anyway

Commented:
smbpasswd -a username
Greg AlexanderLead Developer

Author

Commented:
That changes the password of the username? I did and it did nothing.. I wander if the windows user does not have access to it?

Commented:
add user
then in windows enter username and password, entered in smbpasswd
Greg AlexanderLead Developer

Author

Commented:
I added user and password and used at the windows prompt... the prompted goes away as if I got it correct (I also typed it in wrong and it told me I did).. now I see the share and can get to it without login and but when I double click on it, windows says it can find 192.168.1.4 but can't find Share (which is the name of the share)

Any ideas?

@pmasotta - that didn't really help my situation :(
what are the settings of your [share] section?
have u add your user name in the valid users entry?
to make sure u used the "valid users" instead of guest account, try reboot your PC and map the drive again
Greg AlexanderLead Developer

Author

Commented:
[Share]
    create mask = 0660
    directory mask = 0770
    comment =
    path = /var/www/html/
    read only = no
    available = yes
    browseable = yes
    writable = yes
    guest ok = yes
    public = yes
    printable = no
    locking = no
    strict locking = no
    valid users = testuser

I restarted my cpu and still nothing :(
Greg AlexanderLead Developer

Author

Commented:
Something now, when I use testparm -v it only shows this:

        path = /var/www/html/
        read only = No
        guest ok = Yes
try remove the line "comment = "
and the '/' at the end of path
i.e. path = /var/www/html
Greg AlexanderLead Developer

Author

Commented:
Nothing still
where do u put your smb.conf file?
try
  testparm -v /<fullpath>/smb.conf
to make sure you are testing the correct configuration file
Greg AlexanderLead Developer

Author

Commented:
Yeah it was correct... one question... If I created a Linux user and a samba user, do I need a windows account to match?
no, u can login samba user that is different from Windows users, just select use another user name to connect when you map the shared drive
some more things you may check and try
1. make a new directory /public, set access permission (chmod) as 777 and try map the share directory to /public instead of /var/www/html, which may have .htaccess file and selinux protected
u have to restart samba to make it effective
2. disable selinux (refer to http://www.centos.org/docs/5/html/5.2/Deployment_Guide/sec-sel-enable-disable.html for procedure)
3. check password setting in smb.conf file as stated in http://www.centos.org/docs/4/4.5/System_Administration_Guide/Configuring_a_Samba_Server-Encrypted_Passwords.html
4. if security is not a concern, try put force user and force group as stated in http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-samba-servers.html

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial