Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

In that folder are stored the news files: they can be created by the system administrator to write some informations for the users, as suggested in this link.

I tried as a normal user to add a file in /var/lib/sysnews, but nor this command

echo "Hello world" > /var/lib/sysnews

neither this command

sudo echo "Hello world" > /var/lib/sysnews

worked (it gives permission denied error).

The folder is owned by root user and by the staff group. My normal user was already in the sudo group; I added the staff group for my user, but with no results.

I can add news only by creating a file in one of my folders and then typing

sudo mv myfile /var/lib/sysnews

but it is bothering.

Is there a simpler way to add some news file to that folder without being root?

share|improve this question

marked as duplicate by terdon, goldilocks, Patrick, Gilles, slm May 14 at 15:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Please update answer with the contents of /var/lib/sysnews, i.e. ls -al /var/lib/sysnews –  eyoung100 May 14 at 14:58
    
Summary: you can use any of echo "Hello World" | sudo tee -a /var/lib/sysnews or sudo sh -c "echo \"Hello World\" > /var/lib/sysnews" or switch to root with sudo -i. –  terdon May 14 at 15:00
    
yes sorry, I thought there was a way in the news command or similar to post news without being root: this is why I didn't looked for piping answers. –  BowPark May 14 at 15:22

1 Answer 1

The problem seems to be from redirecting/piping output. Use your favorite editor (vim in my case) and sudo vim /var/lib/sysnews and edit the file through an editor invoked with sudo. Or use one of the sudo commandline redirect workarounds listed above, but none of those seem like the 'simpler' answer.

share|improve this answer

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