LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-28-2014, 03:19 AM   #1
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Rep: Reputation: 103Reputation: 103
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!
 
Old 12-28-2014, 03:36 AM   #2
timl
Member
 
Registered: Jan 2009
Location: Sydney, Australia
Distribution: Fedora,CentOS
Posts: 748

Rep: Reputation: 156Reputation: 156
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
 
Old 12-28-2014, 04:03 AM   #3
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
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)
 
Old 12-29-2014, 06:34 AM   #4
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
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.
 
Old 12-29-2014, 07:21 AM   #5
Miati
Member
 
Registered: Dec 2014
Distribution: Linux Mint 17.*
Posts: 326

Rep: Reputation: 106Reputation: 106
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
 
Old 12-29-2014, 12:16 PM   #6
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
Quote:
Originally Posted by Miati View Post
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)

Last edited by vincix; 12-29-2014 at 12:23 PM.
 
Old 12-29-2014, 02:24 PM   #7
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
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)
 
Old 12-29-2014, 04:23 PM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,592

Rep: Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880
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.
 
Old 12-29-2014, 05:22 PM   #9
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
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.

Last edited by vincix; 12-29-2014 at 05:25 PM.
 
Old 12-29-2014, 06:04 PM   #10
Miati
Member
 
Registered: Dec 2014
Distribution: Linux Mint 17.*
Posts: 326

Rep: Reputation: 106Reputation: 106
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?

Last edited by Miati; 12-29-2014 at 06:13 PM.
 
Old 12-29-2014, 06:17 PM   #11
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
Quote:
Originally Posted by Miati View Post
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.
 
Old 12-29-2014, 07:20 PM   #12
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,592

Rep: Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880
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.
 
1 members found this post helpful.
Old 12-29-2014, 07:27 PM   #13
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
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.
 
Old 12-30-2014, 10:18 AM   #14
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
@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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
GUI for Centos 6.2 basic server install zahid Linux - Newbie 3 06-25-2012 07:49 PM
[SOLVED] Setting up basic lamp server with CentOS 6, opinions for developer access? jraz Linux - Server 4 11-27-2011 07:42 AM
Basic Samba Server or Active Directory Central Login via LAM/LDAP/SAMBA metallica1973 Linux - Server 5 06-09-2010 11:27 AM
setting up basic http server jeffm2792 Linux - Server 18 10-04-2007 09:53 PM
Setting up a basic email server Elijah Linux - Networking 2 09-02-2005 02:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration