librados: client.admin initialization error (2) No such file or directory

环境: Ubuntu 14.04, Ceph 0.80.10

在使用ceph或rados命令时(如:rados -p .rgw ls)发生只能加sudo才可以使用,不然就出现报错:

monclient(hunting): ERROR: missing keyring, cannot use cephx for authentication

librados: client.admin initialization error (2) No such file or directory

 

ls /etc/ceph/ceph.client.admin.keyring -l
-rw——- 1 root root 63 Jan 18 18:45 /etc/ceph/ceph.client.admin.keyring

查看文件的属性才发现只有root用户才可以读取文件ceph.client.admin.keyring。因而修改其权限以便其它用户也可以访问

sudo chmod o+r /etc/ceph/ceph.client.admin.keyring