沒有這樣的檔案或目錄“authorized_keys”

沒有這樣的檔案或目錄“authorized_keys”
$ ssh-keygen -t rsa -P ""
Generating public/private rsa key pair.
Enter file in which to save the key (/home/dhruvhadoop1/.ssh/id_rsa): cat /home/hadoopuser/.ssh/id_rsa.pub >> /home/hadoopuser/ .ssh/authorized_keys
open cat /home/hadoopuser/.ssh/id_rsa.pub >> /home/hadoopuser/ .ssh/authorized_keys failed: No such file or directory.
Saving the key failed: cat /home/hadoopuser/.ssh/id_rsa.pub >> /home/hadoopuser/ .ssh/authorized_keys.
$ chmod 600 authorized_keys
chmod: cannot access ‘authorized_keys’: No such file or directory
$ chmod 600 authorized_keys
chmod: cannot access ‘authorized_keys’: No such file or directory

答案1

這是提示

Enter file in which to save the key (/home/dhruvhadoop1/.ssh/id_rsa)

並且您還沒有回答文件路徑。

因此透過以下方式再次開始生成

su - hadoopuser
ssh-keygen -t rsa -P ""

並使用預設值或其他檔案名,但不使用類似命令cat ...,例如

/home/hadoopuser/.ssh/id_rsa.pub

在那之後

cat /home/hadoopuser/.ssh/id_rsa.pub | sudo tee -a /home/hadoopuser/.ssh/authorized_keys
sudo chmod 600 /home/hadoopuser/.ssh/authorized_keys/authorized_keys

相關內容