sudo echo “something” >> /etc/privilegedFile doesn’t work [duplicate]

Use tee –append or tee -a. echo ‘deb blah … blah’ | sudo tee -a /etc/apt/sources.list Make sure to avoid quotes inside quotes. To avoid printing data back to the console, redirect the output to /dev/null. echo ‘deb blah … blah’ | sudo tee -a /etc/apt/sources.list > /dev/null Remember about the (-a/–append) flag! Just tee … Read more

“UNPROTECTED PRIVATE KEY FILE!” Error using SSH into Amazon EC2 Instance (AWS)

The problem is having wrong mod on the file. Easily solved by executing – chmod 400 mykey.pem Taken from AWS instructions – Your key file must not be publicly viewable for SSH to work. Use this command if needed: chmod 400 mykey.pem 400 protects it by making it read only and only for the owner.

How do I use sudo to redirect output to a location I don’t have permission to write to? [closed]

Your command does not work because the redirection is performed by your shell which does not have the permission to write to /root/test.out. The redirection of the output is not performed by sudo. There are multiple solutions: Run a shell with sudo and give the command to it by using the -c option: sudo sh … Read more

ssh “permissions are too open”

The keys need to be read-writable only by you: chmod 600 ~/.ssh/id_rsa Alternatively, the keys can be only readable by you (this also blocks your write access): chmod 400 ~/.ssh/id_rsa 600 appears to be better in most cases, because you don’t need to change file permissions later to edit it. (See the comments for more … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)