Find the answer to your Linux question:
Results 1 to 5 of 5
Then I try to generate a comment free smb.conf file as sudo using testparm I get an error Code: sudo testparm -s smb.conf.master >smb.conf bash: smb.conf: Permission denied I have ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2011
    Location
    Riverside, California, USA
    Posts
    5

    Question 12.04 testparm won't execute under sudo


    Then I try to generate a comment free smb.conf file as sudo using testparm I get an error

    Code:
    sudo testparm -s smb.conf.master >smb.conf 
    bash: smb.conf: Permission denied
    I have a simple setup with 4 Ubuntu machines on a very small LAN with is behind a firewall. This started happening when I was experimenting with a Scientific Linux distro on one of the machines. Never got samba to work correctly among three Ubuntu machines and SL so I replaced SL with Ubuntu 12.04.

    I'm trying to configure all 4 of my machines identically and intend to use copies of smb.conf.master on all of them.

  2. #2
    Just Joined!
    Join Date
    Sep 2007
    Posts
    3
    I would check the permissions of the files and directories involved, specifically those of . (current directory) and smb.conf. I'm assuming the current working directory is something like /etc/samba, right? Try 'ls -ld . smb.conf'. smb.conf needs write and . needs execute permissions.

  3. #3
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    yes, bmackin1 is in the right. the redirection (>) happens as the regular user, not as root. as a work around, you could try something like this:

    Code:
    sudo bash -c 'testparm -s smb.conf.master > smb.conf'
    also, you might want to specify the full path when writing the file, e.g.:
    Code:
    > /etc/samba/smb.conf
    of course, the above method assumes sudo is set up for the current user to run bash in the first place.

  4. #4
    Just Joined!
    Join Date
    Apr 2011
    Location
    Riverside, California, USA
    Posts
    5
    Solved!
    Needed to quote the command:
    Code:
    sudo bash -c 'testparm -s /etc/samba/smb.conf.master > /etc/samba/smb.conf'
    Thanks, atreyu

  5. #5
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Cheers!

    Marking thread as Solved for you. Note you can do that yourself whenever you want, using the Thread Tools link at the top of the page.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •