LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 03-06-2023, 07:52 PM   #1
Cannondale
Member
 
Registered: Jan 2023
Location: USA
Distribution: Linux Mint
Posts: 39

Rep: Reputation: 1
ssh-copy-id: ERROR: failed to create required temporary directory under ~/.ssh


New to linux and currently setting up ssh on a new workstation named shadow.
I have installed and configured ssh on several machines to date.
However, I am getting an error with ssh-copy-id that In have not seen before.

I have done the following:
Installed ssh on the new workstation (shadow)


Code:
ssh-keygen -t ed25519 -f ~/.ssh/id-25519
Attempted the ssh-copy-id and getting the error below:


Code:
sudo ssh-copy-id -i .ssh/id-25519.pub shadow
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: ".ssh/id-25519.pub"
mktemp: failed to create directory via template ‘/root/.ssh/ssh-copy-id.XXXXXXXXXX’: No such file or directory
/usr/bin/ssh-copy-id: ERROR: failed to create required temporary directory under ~/.ssh
Permissions on ~/.ssh are 700

I have verified that the public key path and name is: ~/.ssh/id-25519.pub

The "‘/root/.ssh/ssh-copy-id.XXXXXXXXXX’" part of the error massage is curious.
What am I missing?
 
Old 03-06-2023, 07:57 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
What user are you doing this as?

EDIT: LOL, just saw the use of "sudo".

Last edited by evo2; 03-06-2023 at 08:09 PM.
 
Old 03-06-2023, 07:58 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,771

Rep: Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933
Code:
sudo ssh-copy-id -i .ssh/id-25519.pub shadow
Why are you using sudo? ssh automatically uses the current username which would be root if running it with sudo. You do not want to login as root and most distributions disable root login by default anyway.

If your usernames are not the same then you would want to use the desired user on the server.

ssh-copy-id -i .ssh/id-25519.pub username@shadow
 
Old 03-06-2023, 07:59 PM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,341
Blog Entries: 3

Rep: Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733Reputation: 3733
The use of sudo is throwing off the location. It runs the command as another user, by default that is root, but either way as another user. Try like this to get the key over to the system "shadow":

Code:
ssh-keygen -t ed25519 -f ~/.ssh/id-25519 -C "some useful comment about the nature of the key"
ssh-copy-id -i ~/.ssh/id-25519.pub username@shadow
 
Old 03-07-2023, 05:55 AM   #5
Cannondale
Member
 
Registered: Jan 2023
Location: USA
Distribution: Linux Mint
Posts: 39

Original Poster
Rep: Reputation: 1
Thanks for the feedback everyone! Removing sudo was the issue!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Could not create temporary gpg home directory in (wrong permissions?) pizpower Ubuntu 5 07-21-2020 07:17 AM
"cannot create temporary directory for the root file system: No space left on device", but df-h says home and root are 77% and inodes are OK roberto32 Linux - General 3 05-27-2018 07:34 AM
Ansible Error - Failed to resolve temporary directory awilisch Linux - Server 1 03-29-2017 04:18 PM
[SOLVED] Create Temporary directory and file in one go .......... prravin1 Programming 8 03-07-2012 07:04 AM
[SOLVED] SVN checkout error:Can't find a temporary directory: Internal error jimtony Linux - Server 7 02-17-2011 09:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration