Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

This command can only be used by root

Tags:

bash

shell

ubuntu

I'm on Ubuntu 16 and I'd like to add a neo4j package. I tried in 3 ways all leading to the same error.

These are my attempts:

wget -O - http://debian.neo4j.org/neotechnology.gpg.key | apt-key add -

sudo wget -O - http://debian.neo4j.org/neotechnology.gpg.key | apt-key add -

sudo -i wget -O - http://debian.neo4j.org/neotechnology.gpg.key | apt-key add -

But I always get this error message:

ERROR: This command can only be used by root.
--2016-11-04  http://debian.neo4j.org/neotechnology.gpg.key
Resolving debian.neo4j.org (debian.neo4j.org)... 52.0.233.188
Connecting to debian.neo4j.org (debian.neo4j.org)|52.0.233.188|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4791 (4,7K) [application/octet-stream]
Saving to: ‘STDOUT’

-                     0%[                    ]       0  --.-KB/s    in 0s      


Cannot write to ‘-’ (Broken pipe).
like image 461
splunk Avatar asked Nov 04 '16 14:11

splunk


People also ask

What command do you use to run as root?

[userA@rhel7 ~]$ su - Password: It's asking for the password of superuser.

How do I run a command as root in terminal?

To run commands with superuser privileges, use the sudo command. sudo stands for superuser do. You're asked for the password of the current user. You're asked to enter the password for adminUsername, after which a new shell is opened for that user.

How do I get root permission in Ubuntu?

To use a "root" terminal, type "sudo -i" at the command line. The entire group of default graphical configuration tools in Kubuntu already uses sudo, so you will be prompted for your password if needed using kdesu, which is a graphical frontend to sudo.

Which command can be used only by super user?

bash - This command can only be used by root - Stack Overflow.


1 Answers

It's the second part of the command that needs to be executed as root.

sudo wget -O - http://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add -

Not super elegant, but it works :)

like image 118
Laurent S Avatar answered Oct 09 '22 23:10

Laurent S