Hi all.

Manuel,just a small addition to Richard's remarks,but please
ignore it,if you had already noticed that.

Commands that using cat with sudo,to redirect the output to 
certain files that users have no write access,will fail. 

Eg. fcron.
#-------------------------------# 
(~/jhablfs)sudo cat >> /etc/syslog.conf << "EOF"
# Begin fcron addition to /etc/syslog.conf

cron.* -/var/log/cron.log

# End fcron addition
EOF
zsh: permission denied: /etc/syslog.conf
#-------------------------------# 

Since the shell is doing the redirection (man bash -REDIRECTION),*before*
the command is executed ,sudo can not see the redirection,so a new shell
is needed for sudo to execute the actual command.

Like so,the previous command should be something like this.
#-------------------------------# 
(~/jhablfs)sudo sh -c "cat >> /etc/syslog.conf << "EOF"
# Begin fcron addition to /etc/syslog.conf

cron.* -/var/log/cron.log

# End fcron addition
EOF"
#-------------------------------# 

Regards.

Ag.
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discuss
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to