Results 1 to 4 of 4

Thread: Sudo and write permissions

  1. #1
    Join Date
    May 2008
    Posts
    588

    Sudo and write permissions

    Hi,

    I want as a normal user in a/sys file can write. The call is. Xsession built:

    sudo echo "something">/sys/somewhere/something

    That, it disagreed. The rights of the file are-rw-r - r -, ie writable for root.

    someone why?

  2. #2
    Join Date
    May 2008
    Posts
    686

    Re: Sudo and write permissions

    This is because only the `echo" something "` is running as root, but the shell tried under their own rights in the file to write. One possible remedy is
    sudo sh-c 'echo "something">/sys/somewhere/something'

    Whether this is however a good idea, the user sudo sh allow, you need to know.

    For "normal" files are acl's for something very good, unfortunately, the (at least on my system) to / sys supports. If you still need other ideas, then ask again for ...

  3. #3
    Join Date
    May 2008
    Posts
    297

    Re: Sudo and write permissions

    The issue is that it's your shell that handles redirection; it's trying to open the file with your permissions not those of the process you're running under sudo.

    Use something like this, perhaps:
    Code:
    sudo sh -c "echo 'something' >> /etc/privilegedFile"

  4. #4
    Join Date
    Dec 2007
    Posts
    845

    Re: Sudo and write permissions

    Hi,

    use the tee command, as follows:

    Code:
    echo 'test' | sudo tee -a /root/test

Similar Threads

  1. On Macbook Pro accidental sudo rm /*
    By venkat=raghavan in forum Portable Devices
    Replies: 5
    Last Post: 14-11-2010, 06:41 AM
  2. I need help with Ubuntu Sudo
    By drios in forum Operating Systems
    Replies: 1
    Last Post: 25-06-2010, 11:29 PM
  3. Update Problem with Sudo apt
    By Gillian Anderson in forum Windows Software
    Replies: 4
    Last Post: 11-03-2010, 10:22 AM
  4. What is sudo command?
    By chaosblade in forum Operating Systems
    Replies: 3
    Last Post: 21-08-2009, 12:18 PM
  5. SUDO under Unix
    By Cecylia in forum Windows Software
    Replies: 4
    Last Post: 24-03-2009, 03:38 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,723,079.61481 seconds with 17 queries