0

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?

BowPark
  • 4,895
  • Please update answer with the contents of /var/lib/sysnews, i.e. ls -al /var/lib/sysnews – eyoung100 May 14 '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 '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 '14 at 15:22

1 Answers1

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.