Fix "Permission denied" issue when running zmsshkeygen command
If you use zmsshkeygen to generate a key but it fails with Permission denied, as in this example:
[zimbra@Ezymailhosting bin]$ ./zmsshkeygen
Generating public/private dsa key pair.
open /opt/zimbra/.ssh/zimbra_identity failed: Permission denied.
Saving the key failed: /opt/zimbra/.ssh/zimbra_identity.
cat: /opt/zimbra/.ssh/zimbra_identity.pub: No such file or directory
Fixing “Permission denied” when running zmsshkeygen
- Check whether selinux is enabled. If it is, disable it and try again, using these steps.
-
Edit /etc/sysconfig/selinux and change:
SELINUX=enforcingto:
SELINUX=disabled -
Run this additional command to disable Selinux:
[root@Ezymailhosting ~]# setenforce 0
-
- SSH may not allow Public Key Authentication, sshd may not be running, or the ssh Port may have changed. Resolve this as follows.
-
Check that sshd (port 22) is enabled. If the ssh port has changed, you can run a command to update it. Suppose the ssh Port on server.domain.com has changed to 22222. Run:
zmprov ms server.domain.com zimbraRemoteManagementPort 22222 -
Check /etc/ssh/sshd_config to make sure PubkeyAuthentication is set to yes.
PubkeyAuthentication yes
-