LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Setting up a basic Samba Server - Centos 6 (https://www.linuxquestions.org/questions/linux-newbie-8/setting-up-a-basic-samba-server-centos-6-a-4175529389/)

vincix 12-28-2014 03:19 AM

Setting up a basic Samba Server - Centos 6
 
Hello,

I've been struggling with this samba server to no avail. I have a centos 6.6 system. The configuration file is really basic (just want to make sure it works outside):
Quote:

[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = name
security = user
map to guest = bad user
dns proxy = no

[allaccess]
path = /samba/allaccess
browsable = yes
writable = yes
guest ok = yes
read only = no
$ smbclient -L localhost displays "allaccess" as a shared folder.

$ smbclient \\\\localhost\\allaccess also works. I've managed to edit it through the samba client.

I have also tested that the /etc/samba/smb.conf is the configuration file samba is working with.

I have disabled iptables altogether to test it.

$ netstat -tulpn | egrep "smb|nmb" displays the following (public ip is of course not shown and is changed to 192.168.1.0/24):
Quote:

tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 1687/smbd
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 1687/smbd
tcp 0 0 :::445 :::* LISTEN 1687/smbd
tcp 0 0 :::139 :::* LISTEN 1687/smbd
udp 0 0 192.168.1.255:137 0.0.0.0:* 15520/nmbd
udp 0 0 192.168.1.1:137 0.0.0.0:* 15520/nmbd
udp 0 0 0.0.0.0:137 0.0.0.0:* 15520/nmbd
udp 0 0 192.168.1.1.255:138 0.0.0.0:* 15520/nmbd
udp 0 0 192.168.1.1:138 0.0.0.0:* 15520/nmbd
udp 0 0 0.0.0.0:138 0.0.0.0:* 15520/nmbd
I've tried connecting through mac (finder - go - connect to server):
smb://192.168.1.1 (with or without /allaccess)

And I've also tried it through windows 7 (on a virtual machine, of course with working internet connection). Run and then:
\\192.168.1.1 with or without \allaccess (but also through \\name, consistent with the net bios directive and after changing it accordingly in windows's hosts)

Can you offer me some other solutions? Thanks!

timl 12-28-2014 03:36 AM

disabled iptables. Do you mean selinux?

I only have a headless install of centos and I can't (off hand) think of how to "ssh -x" to the security settings. But, I am sure there is a setting which opens up samba. My notes on setting up samba include:

Quote:

Go to firewall settings and allow access to samba
Have you started smb/nmb?

Quote:

chkconfig smb on
chkconfig nmb on
and another useful tool is:

Quote:

testparm /etc/samba/smb.conf
A few random thoughts which may help :)

vincix 12-28-2014 04:03 AM

By disable iptables I simply mean $ service iptables stop.

Yes, both nmb and smb are on (it it shown in the netstat output)

This is the output of the testparm command:
Quote:

Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[allaccess]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Ah, and I forgot to write it in the first post. As the tutorial that I've read instructed, I've also run the command:
$ chcon -t samba_share_t /samba/allaccess/ (as you've reminded me of selinux)

vincix 12-29-2014 06:34 AM

I must admit that I'm impressed by the huge support I've received on this forum. Whenever I encounter problems at least I know I'll get the necessary help here.

Miati 12-29-2014 07:21 AM

You wouldn't believe the number of times permissions has been the culplrit of samba setups.

Are you sure access is permitted?

This means that /samba/allaccess must have permissions accessible to the samba user but
/samba/ must also permit access, at least execute & read for the directory

vincix 12-29-2014 12:16 PM

Quote:

Originally Posted by Miati (Post 5291917)
You wouldn't believe the number of times permissions has been the culplrit of samba setups.

Are you sure access is permitted?

This means that /samba/allaccess must have permissions accessible to the samba user but
/samba/ must also permit access, at least execute & read for the directory

These are the current permissions to the directory according to a tutorial I've read on the internet (I can't remember the link to it). So others have read and execute permissions. As I've said in the first post, the idea is to simply test if the samba server works, so there shouldn't be any user restrictions.
Quote:

drwxr-xr-x. 3 nobody nobody 4096 Dec 28 04:15 /samba/allaccess/
/samba directory also has read and execute permissions for others.

The thing is, when I try to connect from mac os (finder - go - connect to server - smb://192.168.1.1/allaccess) it simply says that "the server may not exist or it is unavailable at this time. Check the server name or IP address, your network connection, etc.)" Shouldn't the error be more explicit than that if there were any permission problems?
As I've already said, I've disable iptables just to make sure (through service iptables stop).

If it makes any difference, I should also say that when I connect to samba locally it asks for my user's password, which I can skip by simply pressing enter (by smbclient \\\\localhost\\allaccess or by smbclient -L localhost -> in order to see what folders are shared).

Oh, and that the user on Mac OS does not have a corresponding user on Cent OS (although the Windows VM through which I tried to connect did)

vincix 12-29-2014 02:24 PM

Only now did it occur to me to mention that the server and the client are not on the same network. So I'm trying to connect remotely. I've read that samba doesn't allow remote connections natively, right? I'm really not sure about what I'm doing. And if samba doesn't work, what other options are there? (for both Windows and Mac OS)

michaelk 12-29-2014 04:23 PM

We will need additional information as to what you mean by remotely and what you are trying to accomplish.

You can use a sftp client like filezilla with windows as OS X to transfer files between computers. The details will depend on the above and your network configuration.

vincix 12-29-2014 05:22 PM

I mean to say that they're not on the same LAN (the server and the client - the connection between the two goes through the internet).

The initial idea was to set up the most basic samba server in order to access data (files) on the server. Now that I realise that is not recommended (security, performance, etc.) and a little more complicated to do with samba if the server and the client are on different networks (so NOT on the same LAN), I am trying to find out about some other viable options. I know about filezilla, but I thought maybe I can set up something that looks more native. For instance, browsing and editing the data on the server with explorer or finder, respectively.

Miati 12-29-2014 06:04 PM

Perhaps try public key based ssh? (edit: Actually, scratch that. ssh is amazing in a linux only enviroment, secure cli usage, gui usage, whatever. But I don't believe windows putty supports navigating through explorer - although you could use a form of scp to copy files to and from.)

Quote:

smb://192.168.1.1/allaccess
This is specified to a LAN address. If the samba server is at 192.168.1.1 and your client at another location (not under same network) goes to 192.168.1.1, this is not the same place.
However, if under the same network, you go to 192.168.1.1 I suspect you would find it.

If I go to 192.168.1.1, I don't expect to find your samba server there!
___

Think of internal & external like this:

I am in my house. My postal address is 123 and go to room 1, then room 2.
Then I go to your house at postal address 654 and go to room 1, then room 2.

Are these rooms in the same place?
If I were to describe to someone my location and I said, "I am in room 2", would you know where I am?

vincix 12-29-2014 06:17 PM

Quote:

Originally Posted by Miati (Post 5292231)
Perhaps try public key based ssh? (edit: Actually, scratch that. ssh is amazing in a linux only enviroment, secure cli usage, gui usage, whatever. But I don't believe windows putty supports navigating through explorer - although you could use a form of scp to copy files to and from.)


This is specified to a LAN address. If the samba server is at 192.168.1.1 and your client at another location (not under same network) goes to 192.168.1.1, this is not the same place.
However, if under the same network, you go to 192.168.1.1 I suspect you would find it.

If I go to 192.168.1.1, I don't expect to find your samba server there!
___

Think of internal & external like this:

I am in my house. My postal address is 123 and go to room 1, then room 2.
Then I go to your house at postal address 654 and go to room 1, then room 2.

Are these rooms in the same place?
If I were to describe to someone my location and I said, "I am in room 2", would you know where I am?

I know the difference between private and public IPs. I can't explain each and every time I post something on the subject that I've changed the public ip to a private one (it would have been silly, I think, to write a random public ip). I've already said it in the first post. So, yes, we're talking about and a server on completely different networks.

michaelk 12-29-2014 07:20 PM

With osx you can use the sshfs fuse file system to mount a directory. Still uses sftp to but you get that native look. With windows the only way to get the native look is using a vpn.

Another idea would be go set up your own cloud with owncloud.

Doug G 12-29-2014 07:27 PM

Did you add your windows user in smbpasswd? Make sure file & printer sharing is enabled in your windows machine firewall, and that your windows machine is in the same workgroup as your linux samba server.

If all you need is manual file access from windows, winSCP works over ssh and provides an explorer-like interface.

vincix 12-30-2014 10:18 AM

@Doug, thanks for the advice, but you should really read the posts beforehand. I've already figured out the problem.

@michaelk. Thanks. I'll probably try something sftp related.


All times are GMT -5. The time now is 04:18 AM.