Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Now, I know there are lots of samba questions (about 1400) on ServerFault, and I have browsed through about half of them at least, and not been able to use any of the answers to solve my problem.

We are installing CentOS 6.2 on a new, blank machine - clean install; it will run as a network server to host Asterisk.

I want to configure the machine so I have full, administrative access to root (I mean the "/" root) from my Windows workstation.

This will enable me to use my own, comfortable machine (and Notepad++) to edit all the configuration files. In other words, I should be able to open \\mylinux\etc\samba\ in Windows Explorer and then have full rights to edit smb.conf with my Windows Text Editor.

I have this working very well with CentOS 4, but can't get it working in CentOS 6.2. In the older OS version, there was a GUI for everything, but now I need to learn and do everything from the CLI. I still use the GUI for a few things that I haven't learned how to do form the CLI yet, so I will still make references to the GUI in my notes here.

Now that you know my problem and my goal, here are some details:

  • smb is running and installed and set to runlevel 35.
  • nmb is running and set to runlevel 35.
  • the firewall is wide-open on eth0 and network is ON (I ran this command: iptables -A INPUT -s 192.168.0.0/255.255.255.0 -j ACCEPT)
  • I have added my own user account on the linux box to the root group.
  • that user account has the same username and password as my Windows computer.
  • samba is configured to know the name of my Windows workgroup
  • I am able to ping \\mylinux from \\mywindows just fine, and vice-versa, also.
  • If I open Network in \\mylinux, I get an error saying: "Failed to retrieve share list from server" which I posted about here.
  • If I do a net view from \\mywindows, then it does not see \\mylinux at all.
  • samba is configured to share the root drive:

.

[root]
comment = Root Directory
path = /
valid users = @root all root group
invalid users = None
writeable = yes
browseable = yes
  • also, in /etc/samba/smbusers.conf, I have made my entry:

    myuser = myuser

Now, you would think that I could access the linux share at this point. But when, from my Windows computer, I try to map the path \\mylinux\root\, I get an error saying the destination does not exist. On my old linux machine, I am able to browse even to \\oldlinux\ and get a list of shares. I can't seem to duplicate the functionality!

[EDIT]

Okay, I disabled the firewall completely, and now I can browse the files wherever I want to go. What remains is the permissions now to edit a file like smb.conf. In other words, my user account that I use to browse the files, which is in the root group, also needs root permissions. How do I get that?

share|improve this question
    
This is a really, really, really bad idea from a security POV. Also, samba will occasionally screw up file permissions, which makes this even worse. Please don't do this. Install WinSCP or something, but don't try to manage a production server over samba. –  devicenull May 22 '12 at 0:53
    
@devicenull - You are right, and I agree with you completely. However, I am safely behind a firewall, and will only be using this kind of access from within my LAN. And there is no risk in-house for security. –  BGM May 22 '12 at 3:39

2 Answers 2

Samba maps your access to a Unix user account on the server, and the normal permissions for that user are enforced. This is therefore the same as granting a Unix user write access to these files. You either need to actually be the root user (i.e. act as the owner of the files, which has write permission), or you need to be in a group which has group write permissions to the files. The latter is (marginally) preferable, so add yourself to the root group and change the file permissions to allow group writes. (I'm assuming that you are aware of the security implications of doing this.)

share|improve this answer
    
thanks for answering. I do understand the security risks. In my original problem, my user was a member of the root group. However, I did manage to solve the problem - see my answer, too! –  BGM May 22 '12 at 0:48
up vote 0 down vote accepted

Finally got it! It took two things: - Disable selinux - uncomment the line in smb.conf for

username map = /etc/samba/smbusers

And, in smbusers.conf, I added root = myuser then, run the command:

smbpasswd -a myuser
smbpasswd -e myuser
service smb restart

Now I can connect to the machine from my windows computer, browse the files in root, and edit them with my favourite text editor on my windows computer.

Just a note for all - I do understand it is a security risk working the procedures that I am working, but I am behind a secure firewall-router, and will only be administering the machine in this fashion from within the LAN.

share|improve this answer
    
Please could you mark your answer as accepted, so that others know that this is the solution. –  mgorven May 22 '12 at 1:19
    
Ha! I have to wait two days, it tells me! It is only 8 hours over on Stack Overflow. –  BGM May 22 '12 at 1:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.