sudo date > output.txt
bash: output.txt: Permission denied
I want to write log message into file, but the permission denied even I add prefix sudo
, But when I tried after making output.txt
file and changing permission to 755
, It works well.
How can I write log meesage without making file and changing permission?
simply like sudo date > output.txt --chmod 755 ?