Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am not sure if this is the correct forum for a Centos6.7/Centos 7 question but I'll ask:
I have my Centos6.7 client physically connected(hard-wired) to my Centos 7 server. I did a ssh-keygen on the client cpu and made sure my Centos 7 server was setup to receive the file from the client.(or maybe it isn't but let me give you the error) i then ran the following command:
ssh-copy-id -p35982 cajunchief@172.34.0.15 and got the following error msg:
"Bad port 'exec sh -c 'umask 077; test -d ~/.ssh || mkdir ~/.ssh ; cat >> ~/.ssh/authorized_keys && (test -x /sbin/restorecon && /sbin/restorecon ~/.ssh ~/.ssh/authorized_keys >/dev/null 2>&1 || true)''
[cajunchief@cajunchiefcom .ssh]$"
Hostname is ok, date command works, ssh-copy-id didnt?
$ ls -al ~/.ssh drwx------. 2 user group 4096 Jun 13 20:14 .
drwx--x---+ 58 user group 4096 Jun 15 16:02 ..
-rw-------. 1 user group 713 Jun 13 20:14 config -rw-------. 1 user group 668 Aug 29 2015 id_dsa -rw-r--r--. 1 user group 624 Aug 29 2015 id_dsa.pub -rw-------. 1 user group 3243 Feb 12 19:55 id_rsa -rw-r--r--. 1 user group 760 Feb 12 19:55 id_rsa.pub
-rw-r--r--. 1 user group 3581 Jun 13 20:14 known_hosts
Then give a second glance to what I have put in bold in the output above.
SSH is very careful regarding file ownership and permissions and just refuse to execute if it feels unsafe.
I am not sure it is the solution to your problem, but it least check it.
All ssh-copy-id is is a script that pastes the contents of ~/.ssh/id*.pub into ~/.ssh/authorized_keys on the remote machine. It's trivially easy to do this by hand if necessary.
SSH is very careful regarding file ownership and permissions and just refuse to execute if it feels unsafe.
I am not sure it is the solution to your problem, but it least check it.
Definitely, file-permissions ought to be among the first things that you verify. If the permissions on, say, the .ssh directory and its various contents are not "exactly correct," ssh will ignore them.
Since you are using a non standard port you need to use quotes i.e.
ssh-copy-id "-p 35982 cajunchief@172.34.0.15"
michaelk,
I thought you might be correct so I tried it and got this: ssh-copy-id"-p 35982 cajunchief@172.34.0.15"
bash: ssh-copy-id-p 35982 cajunchief@172.34.0.15 command not found
Definitely, file-permissions ought to be among the first things that you verify. If the permissions on, say, the .ssh directory and its various contents are not "exactly correct," ssh will ignore them.
sundialsvcs, thanks a friend of mine told me the same thing! I am checking it.
$ ls -al ~/.ssh drwx------. 2 user group 4096 Jun 13 20:14 .
drwx--x---+ 58 user group 4096 Jun 15 16:02 ..
-rw-------. 1 user group 713 Jun 13 20:14 config -rw-------. 1 user group 668 Aug 29 2015 id_dsa -rw-r--r--. 1 user group 624 Aug 29 2015 id_dsa.pub -rw-------. 1 user group 3243 Feb 12 19:55 id_rsa -rw-r--r--. 1 user group 760 Feb 12 19:55 id_rsa.pub
-rw-r--r--. 1 user group 3581 Jun 13 20:14 known_hosts
Then give a second glance to what I have put in bold in the output above.
SSH is very careful regarding file ownership and permissions and just refuse to execute if it feels unsafe.
I am not sure it is the solution to your problem, but it least check it.
tshikose,
I looked at your files and mine looks okay too or so I think. but here is what the output is:
ls -al ~/.ssh
total 24
drwx------. 3 cajunchief cajunchief 4096 Jan 18 16:05 .
drwx------. 43 cajunchief cajunchief 4096 Jun 15 14:41 ..
drwxrwxr-x. 2 cajunchief cajunchief 4096 Jan 18 16:08 cajunchieflgt
-rw-------. 1 cajunchief cajunchief 3311 Jun 10 12:21 id_rsa
-rw-r--r--. 1 cajunchief cajunchief 746 Jun 10 12:21 id_rsa.pub
-rw-r--r--. 1 cajunchief cajunchief 1587 Apr 30 17:35 known_hosts
$ ls -al ~/.ssh drwx------. 2 user group 4096 Jun 13 20:14 .
drwx--x---+ 58 user group 4096 Jun 15 16:02 ..
-rw-------. 1 user group 713 Jun 13 20:14 config -rw-------. 1 user group 668 Aug 29 2015 id_dsa -rw-r--r--. 1 user group 624 Aug 29 2015 id_dsa.pub -rw-------. 1 user group 3243 Feb 12 19:55 id_rsa -rw-r--r--. 1 user group 760 Feb 12 19:55 id_rsa.pub
-rw-r--r--. 1 user group 3581 Jun 13 20:14 known_hosts
Then give a second glance to what I have put in bold in the output above.
SSH is very careful regarding file ownership and permissions and just refuse to execute if it feels unsafe.
I am not sure it is the solution to your problem, but it least check it.
tshikose,
Anata wa nihonjin desu ka?
Thank you for your suggestion I ran the same command and this is what I got:
ls -al ~/.ssh
total 24
drwx------. 3 cajunchief cajunchief 4096 Jan 18 16:05 .
drwx------. 43 cajunchief cajunchief 4096 Jun 15 14:41 ..
drwxrwxr-x. 2 cajunchief cajunchief 4096 Jan 18 16:08 cajunchieflgt
-rw-------. 1 cajunchief cajunchief 3311 Jun 10 12:21 id_rsa
-rw-r--r--. 1 cajunchief cajunchief 746 Jun 10 12:21 id_rsa.pub
-rw-r--r--. 1 cajunchief cajunchief 1587 Apr 30 17:35 known_hosts
You still did not add a space between the command and the command line argument. bash still thinks it is a single command. copy-ssh-id" -p.. is not the same thing as copy-ssh-id "-p...
You still did not add a space between the command and the command line argument. bash still thinks it is a single command. copy-ssh-id" -p.. is not the same thing as copy-ssh-id "-p...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.