我在Ubuntu os上配置hadoop。我需要创建RSA密钥对以允许hadoop与其节点进行交互,因此我运行此命令:
hadoop@ubuntu:~$ ssh-keygen -t rsa -P ""
然后我明白了:
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hadoop/.ssh/id_rsa):
Could not create directory '/home/hadoop/.ssh': permission denied.
Enter passphrase (empty for no passphrase ):
Enter same passphrase again:
open /home/hadoop/.ssh/id_rsa failed: No such file or directory.
Saving the key failed: /home/hadoop/.ssh/id_rsa.
答案 0 :(得分:6)
忘记在家中创建.ssh
目录?
试试:
mkdir -p ~/.ssh
然后重新运行ssh-keygen。
也可能是你从错误的用户那里创建了ssh-key ..你是用sudo启动那个shell的?
尝试手动设置HOME目录或在提示符下输入正确的路径。
答案 1 :(得分:1)
检查您的主目录名称和权限
echo $HOME
cd ~ ; ls -l
ls -l .ssh
ls -lR .ssh
如果上面的输出正常并且你有正确的权限,那么你的配额可能已满了
尝试“sudo”,看看会发生什么......
答案 2 :(得分:0)
似乎当前用户不拥有主目录下的内容。
获得所有权,如下所示:
admin@mydb22-02:~$ sudo chown admin.admin /home/admin/
admin@mydb22-02:~$ ls -la
total 32
drwxr-xr-x 2 admin admin 4096 Nov 3 23:29 .
drwxr-xr-x 3 admin admin 4096 Dec 23 2012 ..
-rw------- 1 admin admin 191 Feb 13 2013 .bash_history
-rw-r--r-- 1 admin admin 220 Apr 3 2012 .bash_logout
-rw-r--r-- 1 admin admin 3486 Apr 3 2012 .bashrc
-rw-r--r-- 1 admin admin 675 Apr 3 2012 .profile
-rw-r--r-- 1 admin admin 0 Nov 3 23:29 .sudo_as_admin_successful
-rw------- 1 admin admin 4221 Nov 3 20:31 .viminfo
生成密钥现在可以正常工作,因为.ssh目录现在将在生成不对称密钥后由当前用户创建和拥有
答案 3 :(得分:0)
I have spent arround 1 hr on this and finally got the solution. It is due to permission problem. You have to use chown for your 'hadoop user'. 1. First make hadoop directory. cd /home mkdir hadoop then check 'ls -l'. it gives result like : drwxr-xr-x 2 hadoop hadoop 4096 Aug 22 22:17 hadoop 2. sudo chown hadoop.hadoop /home/hadoop/ 3. Then run remaining command for key generater.