One_auth file is not present in opennebula

/usr/lib/one/ruby/opennebula/client.rb:130:in initialize': ONE_AUTH file not present (RuntimeError) from /usr/lib/one/ruby/cli/one_helper.rb:373:innew’
from /usr/lib/one/ruby/cli/one_helper.rb:373:in get_client' from /usr/lib/one/ruby/cli/one_helper.rb:431:inset_client’
from /usr/bin/oneuser:43:in block (2 levels) in <main>' from /usr/lib/one/ruby/cli/command_parser.rb:445:inrun’
from /usr/lib/one/ruby/cli/command_parser.rb:76:in initialize' from /usr/bin/oneuser:36:innew’
from /usr/bin/oneuser:36:in `’

The file should have been created when you have installed OpenNebula. You can try to change it from ssh console by running this:

oneuser 0 passwd newpassword

Hello,
The file is there but marked crossed.

That’s why unable to read that file and produced file not present error.

Not quite sure what you mean by “marked crossed”. The file should have oneadmin:oneadmin ownership and to look like this:

4 -rw-r--r-- 1 oneadmin oneadmin 42 Mar 23 19:41 one_auth

Marked cross I mean I don’t have privilege to access that. one_auth file
is present in two places, (1) /var/lib/one/.one (here the .one folder is
locked) and (b) /home/neha/.one (I can access this file). Is it
necessary to access the one_auth file which is present in
/var/lib/one/.one?

By default, if you have installed opennebula using yum, the file should be in /var/lib/one/.one/one_auth. You can issue a su - oneadmin and play from there. No clue about why you have such a file in /home/neha/.one

How did you install opennebula?!

using this link:
Front-end Installation — OpenNebula 5.0.2 documentation

The one_auth file location should be in /var/lib/one/.one/one_auth. And the file is not locked. You can’t access it if you are connected under the user neha. Issue a sudo su - to become root, then you can just issue a su - oneadmin so you’ll be able to manipulate/access that file. Logged on your server as oneadmin:

$> echo "oneadmin:password" > "~/one_auth"

and then define the ONE_AUTH variable:

$> export ONE_AUTH="~/one_auth"

Then as root, issue a systemctl restart opennebula and you should be good to go.

I did what you have suggested. I got no such file or directory message.
Please find the attachments of the terminal output.

Even I am unable to get the root privileges in oneadmin account. Authentication failure message occured. Please help me what should I do?

Is it OK for you to connect with my system through teamviewer? I think then only you will get where actually the problem is.

The problem is in the command:

echo "oneadmin:password" > "~/one_auth"

It should be executed as oneadmin user:

echo "oneadmin:password" > ~/.one/one_auth

or even better, explicitly:

sudo su - oneadmin -c 'echo "oneadmin:password" > /var/lib/one/.one/one_auth'

If this does not work post the output of:

sudo su - oneadmin -c 'ls -al /var/lib/one/'

Consider also going through http://swcarpentry.github.io/shell-novice/

Hello Marcindulak,
Thank you for the reply. Commands are not working and output is attached.

I added “oneadmin ALL=(ALL)ALL” line in the /etc/sudores file. Then when I issued udo su - oneadmin -c ‘ls -al /var/lib/one/’ I got the output as

No, oneadmin does not need sudo rights to run all commands, please remove “oneadmin ALL=(ALL)ALL” line from the /etc/sudores file. Actually the problems are most likely due to running some command with sudo - don’t do this unless you are absolutely sure that the given action needs sudo.

To correct the current state:

[root@frontend one]# ls -al
total 144
drwxr-x—. 8 oneadmin oneadmin 158 Aug 14 08:07 .
drwxr-xr-x. 30 root root 4096 Aug 14 07:58 …
-rw-r–r–. 1 root root 231 Aug 14 07:58 .bashrc
-rw-r–r–. 1 root root 0 Aug 14 08:07 .cache
-rw-r–r–. 1 root root 8075 Aug 14 08:01 config
drwxr-x—. 5 oneadmin oneadmin 33 Aug 14 08:01 datastores
drwxr-xr-x. 2 root root 131 Aug 14 08:01 .one
-rw-r–r–. 1 root root 128000 Aug 14 08:07 one.db
drwxr-x—. 11 oneadmin oneadmin 181 Aug 14 07:59 remotes
drwx------. 2 root root 57 Aug 14 08:01 .ssh
drwxr-xr-x. 2 root root 6 Aug 14 08:01 sunstone_vnc_tokens
drwxr-x—. 2 oneadmin oneadmin 6 Jul 20 09:30 vms

do, as your unprivileged user (your user on ubuntu, which has sudo rights):

[unprivileged@frontend ~]$ sudo su - -c ‘chown -R oneadmin.oneadmin /var/lib/one/’
[unprivileged@frontend ~]$ sudo su - -c ‘ls -al /var/lib/one/’
total 208
drwxr-x—. 8 oneadmin oneadmin 158 Aug 14 08:10 .
drwxr-xr-x. 30 root root 4096 Aug 14 07:58 …
-rw-r–r–. 1 oneadmin oneadmin 231 Aug 14 07:58 .bashrc
-rw-r–r–. 1 oneadmin oneadmin 0 Aug 14 08:07 .cache
-rw-r–r–. 1 oneadmin oneadmin 8075 Aug 14 08:01 config
drwxr-x—. 5 oneadmin oneadmin 33 Aug 14 08:01 datastores
drwxr-xr-x. 2 oneadmin oneadmin 131 Aug 14 08:01 .one
-rw-r–r–. 1 oneadmin oneadmin 138240 Aug 14 08:10 one.db
drwxr-x—. 11 oneadmin oneadmin 181 Aug 14 07:59 remotes
drwx------. 2 oneadmin oneadmin 57 Aug 14 08:01 .ssh
drwxr-xr-x. 2 oneadmin oneadmin 6 Aug 14 08:01 sunstone_vnc_tokens
drwxr-x—. 2 oneadmin oneadmin 6 Jul 20 09:30 vms

The whole /var/lib/one must be owned by oneadmin user, including subdirectories and hidden files.

I have removed the added line from /etc/sudoers file and issued the commands suggested by you. Again I am getting below error.

Sorry, user oneadmin is not allowed to execute ‘/bin/su - oneadmin -c ls -al /var/lib/one/’ as root on neha-HP-Compaq-8100-Elite-CMT-PC.

The output is attached.

The main problem is /var/lib/one is not accessible by oneadmin.

Have you executed:

[neha@neha-HP-Compaq-8100-Elite-CMT-PC ~]$ sudo su - -c ‘chown -R oneadmin.oneadmin /var/lib/one/’