mkdir: '.ssh' ディレクトリを作成できません: ssh-copy-id の権限が拒否されました。

mkdir: '.ssh' ディレクトリを作成できません: ssh-copy-id の権限が拒否されました。
┌─╼ [~/Downloads]
└╼ ssh-copy-id -i ~/.ssh/id_ed25519 my_username@server
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/infinity/.ssh/id_ed25519.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
my_username@server's password: 
Could not chdir to home directory /gel/usr/my_username: No such file or directory
sh: line 0: cd: /gel/usr/my_username: No such file or directory
mkdir: cannot create directory ‘.ssh’: Permission denied

サーバーに接続しましたが接続できませんmy_username/gel/usrこの問題を解決するための回避策はありますか?この問題を解決するために、どのような方法でサーバーで$ PATHを変更できますか?

ベストアンサー1

エラー行が示すように、この場所にホームディレクトリはありません。

Could not chdir to home directory /gel/usr/my_username: No such file or directory

/home/たとえば、通常、ホームディレクトリは/home/username

ファイルを直接編集し/etc/passwd、正しい既存のパスを入力するか、コマンドを使用してusermod以下のようにホームディレクトリを変更できます。

usermod -d /home/username username

状況に合わせてユーザー名のインスタンスを変更する必要があります。

おすすめ記事