Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I'm trying to copy some files from my machine to an Azure VM. I say in advance that I can ssh the Azure's VM, I gave my public key during the creation of the machine. Both machines are Linux.
When I try:
sudo scp /path/ca.crt ubuntu#ip.add.res.s:~/
I receive in output:
Permission denied (publickey).
lost connection
I'm not pointing on a root directory (my file is in a root directory that's why the sudo); I'm not pointing to a wrong user; if I can connect through ssh why scp should be denied?
Using sudo to access a root file, scp is going to look for the identity file id_rsa in /root/.ssh/ instead of in /home/user/.ssh/. That's why I have to specify the identity file in the scp command (not the public key):
sudo scp -i ~/.ssh/id_rsa /path/ca.crt ubuntu#ip.add.res.s:/home/ubuntu/
I hope that this can be useful to someone else.
Cheers.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed last year.
Improve this question
"/etc/docker/daemon.json"
"/etc/docker/daemon.json" E212: Can't open file for writing
I’m currently trying to set up a Loki server, Promtail, and Grafana as docker images
I installed all the plugins needed however when I tried editing the docker daemon config file with this command
sudo nano /etc/docker/daemon.json
It does not allow me to write due to permissions so I tried using
sudo vi chmod 666 /etc/docker/daemon.json
but this only creates a new file in my directory called chmod
The docker containers are up but I can't see the Loki metrics on my web browser when I try to use localhost:3100/metrics neither can it can be added as a Datasource
Please can you help?
It should be sudo chmod 666 /etc/docker/daemon.json.
What you are doing is running vi against 3 files, chmod, 666, /etc/docker/daemon.json.
The directory /etc/docker must also exist as a directory, and not as a file.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
How do I regain access to my home folder?
I was trying to get shared folders to work in VirtualBox and I changed the user group to vboxsf by invoking
sudo usermod -a -G vboxsf dev
I rebooted then I lost access to /home/dev, the home user folder.
I tried to fix it but it did not work. The changes do not get persisted!!
I own the VM. How do I fix this?
The solution is simple. Just change the ownership of the folder "/home/dev"
you can do this by chown command:
sudo chown -R vboxsf:vboxsf /home/dev
and then your ownership and group will be changed from root to vboxsf
Check if the home directory is existing by doing ls -ltrh /home if you see directory named dev then check it's owner
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
So I wanted to copy a folder from a remote server to my local computer. I am using WSL (Windows Subsystem for Linux)/ Ubuntu.
First, I ssh into the server using ssh user#host.
Then I wrote the scp command which is scp -r user#host:/var/www backup-9-feb
But now I cant find this backup-9-feb folder, please help. Unfortunately, I forgot the name of the folder too. This is just an example.
After I executed these commands, A long list of files with there paths were shown
You don't need to ssh into the server to use scp. You want to do the following on your computer: scp -r server_user#server_host:/var/www backup-9-feb. This will copy (recursively) the directory /var/www of the server to the directory where you ran this command on your machine.
Note: scp is going to be deprecated so you probably want to start using an utility like rsync (works similarly).
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I am sorry if this is something obvious but I am new to Linux.
I was trying to set a git bare directory and for this I installed ACL on Ubuntu. Then I ran the following commands:
adduser git
mkdir /repositories
chmod 700 /repositories
setfacl -m defaut:user::rwx /repositories
sudo chown git:git /repositories
Everything was fine until I rebooted the machine. Now I am unable to execute sudo anymore. Everytime I do it as myself I get following message:
[[sudo]] password for Andre:
Sorry, try again
The password I enter is the same I always used, and I don't have any problem to SSH with these account credentials.
Does anyone knows what happened and how to fix it?
I think that the issue was with setfacl. I should have used 'repositories' instead of '/repositories'. In that way I set acl across the root. I ended up reinstalling Linux.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I have accidently deleted the folder of defaut user ubuntu in my ec2 server , son whene i want to reconnecte to ssh , it gives me Permission denied (publickey).
Please my friends , really i'm blocked i have my data in this server and i can't find any way to access , please help me to solve this.
Stop the VM
In the EC2 console, under 'Actions' select 'View/Change User Data'
Enter the following, replacing the <username> with the desired username, and <publickey> with your public key from your computer
#!/bin/bash
useradd -ms /bin/bash <username>
mkdir /home/<username>/.ssh
echo '<publickey>' >> /home/<username>/.ssh/authorized_keys
chown -R <username>:<username> /home/<username>/.ssh
chown -R 600 /home/<username>/.ssh
Save and start VM