Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed last month.
Improve this question
How can I setup access for multiple private repositories in Cpanel?
I've tried many tutorials and documentation. Here is one of them:
https://docs.cpanel.net/knowledge-base/web-services/guide-to-git-set-up-access-to-private-repositories/
But I'm always got this error:
Permission denied (publickey). fatal: Could not read from remote
repository.
It seems like we can only use the default name (id_rsa). I've tried this code:
ssh-keygen -t rsa -b 4096 -C "username#example"
It works fine. But it will generate the default (which is id_rsa). This means that we can't deploy multiple private repos, right? Because we can only use "id_rsa".
So is it possible to create an ssh key without a default name? Also, how to create multiple private repos in Cpanel?
EDIT:
Here is what I've done:
Cpanel > Terminal > Enter this code to generate SSH Key:
ssh-keygen -t rsa -f ~/.ssh/top25vineyards -b 4096 -C "topviney#top25vineyards.com"
SSH Access > Manage SSH Keys > Copy the Public Keys
Open the GitHub repo > Settings > Deploy Keys > Paste the keys
Repeat points 1-3 for the second repo. Here is the command to generate the key:
ssh-keygen -t rsa -f ~/.ssh/top25restaurants -b 4096 -C "topviney#top25vineyards.com"
Create config file on ssh folder:
Test the SSH keys by doing this in the terminal:
ssh -i ~/.ssh/top25restaurants -T git#github.com
ssh -i ~/.ssh/top25restaurants -T git#github.com
Both return this message:
Hi <username/repo_name>! You've successfully authenticated, but GitHub does not provide shell access.
Git Version Control > Create > Enter the details:
But when I always got this error:
Am I missing something?
EDIT 2:
I've tried different Clone URL and it gives this error:
So is it possible to create an ssh key without a default name? Also, how to create multiple private repos in Cpanel?
That is what the documentation you are referring to mentions.
Set up access to multiple repositories
To create an SSH key for each of your repositories, follow the steps outlined above.
After you have added the keys to the remote repositories, create a local ~/.ssh/config file to alias each of the keys to their corresponding repository names.
For example, if you have two repos configured on GitHub, testing and testing2, and both your cPanel and GitHub usernames are cptest, create or modify the ~/.ssh/config file with these contents:
Host testing.github.com
Hostname github.com
IdentityFile /home/cptest/.ssh/testing
User git
Host testing2.github.com
Hostname github.com
IdentityFile /home/cptest/.ssh/testing2
User git
Compared to their documentation, I would use:
IdentityFile /home/cptest/... (instead of IdentityFile=...)
User git
a FQDN-like Host entry: xxx.yyy.com
That way, the URL becomes: git clone testing.github.com:me/myRepo
If the cPanel requires a valid protocol, use:
ssh://github.com-testing/me/myRepo
^^^^^^ ^^^
(valid protocol) (/, not :)
In your case:
ssh://top25vineyards.github.com/me/myRepo
ssh://top25vineyards.github.com/Penk13/top25vineyards
(to mimic an fully-qualified domain name)
Related
I have a docker container running and it's exposing port 22 to local host port 1312. I am using the following command to run the container:
docker run -it -d -p 127.0.0.1:1312:22 -v
/workspace/project:/root --name
cpp_dep cpp_dep
Now to build the project in CLion, it need to be able to ssh into the container. I entered the container in interactive mode and ran "service ssh restart".
Now when I try to ssh into root#127.0.0.1:1312, it asks for my password. But when I enter my sudo (root) password, it keeps saying permission denied.
Is it an issue with ssh key? Which password should i use? or is there any way to bypass the password?
I am running a MAC OS.
Thanks in advance.
You may enter the container in interactive mode, use whoami to find the current user while use passwd to change the password of current user, then ssh into it using the updated passwd.
More details if you are interested:
User running the container is decided by
USER config in your Dockerfile: https://docs.docker.com/engine/reference/builder/#user
-u option in docker run command: https://docs.docker.com/engine/reference/run/#user
By default it's root (uid = 0), but it depends on your settings.
User password is stored in /etc/passwd file, which is different inside the container and in the host, so the same uid may have different password inside the container. It's a workaround to mannually reset it using passwd in the interactive mode but your may also set it in Dockerfile like
RUN echo 'root:Docker!' | chpasswd // (NOTICE: unsafe!)
It changes the password for root as "Docker!"
EDIT #1
As emphasized by David Maze in comments, it's unsafe to store plain password in the Dockerfile as it's public to anyone who get the source file, and it's not uncommon source files intended to be private mistakenly submitted to open github repository. If the container needs to provide public service, you must use build args (https://docs.docker.com/engine/reference/commandline/build/#set-build-time-variables---build-arg) so password can be secretly specified at build time.
Dockerfile:
ARG PASSWD
RUN echo 'root:${PASSWD}' | chpasswd
build:
docker build --build-arg PASSWD=<secret stored safely>
I have read: BitBucket: Host key verification failed and Jenkins Host key verification failed and several other links provided. I seem to find myself in an odd situation.
I want to clone my django repo into a digital ocean droplet. I am following the steps of this document. https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-18-04 .
Everything seems to have gone well, until the step where I need to create the django project. I already have a django project and thus don't want to create a new project on the server. I only need to clone it onto the server.
I ran : root#ubuntu-s-1vcpu-2gb-xxx:~#rsync --archive --chown=llewellyn:llewellyn ~/.ssh /home/llewellyn
My bitbucket has the id_rsa SSH key uploaded and it all worked in the past, no new SSH has been generated. And the repo is set to public.
When running:
(myprojectenv) llewellyn#ubuntu-s-1vcpu-2gb-xxx:~/myprojectdir$ git clone git#bitbucket.org:LlewellynHattinghLH/repo.git
Cloning into 'repo'...
Warning: Permanently added the RSA host key for IP address '18.205.xx.x' to the list of known hosts.
git#bitbucket.org: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I have tried several articles, but most only tell me how to create a new SSH.
Any help would greatly be appreciated.
First, you can do:
export GIT_SSH_COMMAND='ssh -Tv'
Then the git clone will be more verbose, giving you more clues as to why it fails.
Second, regarding the permissions:
Your ~/.ssh must be 700, you keys 600: check that with ls -alrth ~/.ssh.
Note: what should be uploaded to your BitBucket is the id_rsa.pub public key, not the id_rsa private key.
I need ssh to another server with SSH from Google Cloud Build. I try run this. But it's not working. echo ${_KEY_STAGING} >> keyStaging && ssh -i keyStaging phihoang#${_SERVER_STAGING} -p 2222
Based on the error message that you are receiving:
Permissions 0644 for '/Users/tudouya/.ssh/vm/vm_id_rsa.pub' are too open. It is required that your private key files are NOT accessible by others
It is necessary to run the following command
chmod 600 /Users/tudouya/.ssh/vm/vm_id_rsa.pub
This command must be executed by the user tudouya and will be remove access for other users, fixing your issue.
I'm trying to follow along the Upskillcourses.com web dev online course. In lesson 11 I'm supposed to link up cloud9 to github.
I'm trying to get the SSH key. But it's not working:
ec2-user:~/environment $ cat ~/.ssh/id_rsa.pub
cat: /home/ec2-user/.ssh/id_rsa.pub: No such file or directory
I've copied it exactly like the instructor did. I'll be honest in that I don't really know what I'm doing or how to fix. Seems like no one else is having this problem. Thanks for any help
Use ssh-keygen to create a default ssh key pair, for now without passphrase:
ssh-keygen -t rsa -C "MyEmailAddress" -f ~/.ssh/id_rsa -P ""
Then any ssh command will use by default that key.
First, check for existing SSH Key using the following command:
ls -al ~/.ssh
Check the directory listing to see if you already have a public SSH key. By default, the filenames of the public keys are one of the following: id_xxxx.pub (ex: id_rsa.pub). If you don't have an existing public and private key pair, create one using this command:
ssh-keygen -t rsa -b 4096 -C "your_email#example.com"
This creates a new ssh key, using the provided email as a label. When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location. At the prompt, type a secure passphrase.
If you see an existing public and private key pair listed that you would like to use to connect to GitHub, or once you are done with the above key generation step, you can add your SSH key to the ssh-agent with the following commands:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa (Add -K option, if on MAC OS, as it will add the passphrase in your keychain when you add an ssh key to the ssh-agent.)
Source: https://docs.github.com/
This happened to me when I was simply in a directory other than the one where the SSH key was.
In order to fix this: you need to check the path to the directory where the SSH key was saved. Scroll up to where you created the key and you should see:
Your public key has been saved in /Users/userlocation/.ssh/id_rsa.pub
Now check your working directory:
pwd
If your working directory is different from the one that holds the SSH key, change the directory:
cd /Users/userlocation #find yours!
and then run the command (slightly changed):
cat .ssh/id_rsa.pub
This worked for me! (Remember to run ssh-keygen first!)
Using AWS (Amazon Web Services) I have created an Ubuntu 16.10 instance and I am able to login using a pem file like this:
ssh -i key.pem ubuntu#52.16.73.14.54
After I am logged, I can see that I am able to execute:
sudo su
(with no password), however the file /etc/sudoers does NOT contain any reference to the user current user: ubuntu.
How can I create another user with exactly the same behavior (without touching the sudoers file) from terminal in a NON interactive way?
I tried:
sudo useradd -m -c "adding a test user" -G sudo,adm -s /bin/bash testuser
But after I become "testuser" if I invoke:
sudo su
I have to provide a password. Which is exactly the way I want to avoid.
You can't do this without touching sudo, beacuse the ubuntu user is given passwordless access specifically.
$ for group in `groups ubuntu`; do sudo grep -r ^[[:space:]]*[^#]*$group[[:space:]] /etc/sudoers* ; done
/etc/sudoers.d/90-cloud-init-users:ubuntu ALL=(ALL) NOPASSWD:ALL
/etc/sudoers.d/90-cloud-init-users:ubuntu ALL=(ALL) NOPASSWD:ALL
/etc/sudoers:%sudo ALL=(ALL:ALL) ALL
But what you can do is create a new sudoers file without touching any existing files. sudo is typically configured these days to read all the configurations in a directiory, usually /etc/sudoers.d/, preceisely so that one failing config doesn't effect the rest of sudo.
In your case, you might want to give an admin group sudoless access rather than your user. Then you can add access in the future to other users without changing sudo config.