0

I have been given ssh access to a new Linux server which has nothing more than the LAMP stack installed on it. It's down to me to install things like Drush, phpmyadmin etc and general configuration of the web server.

My ssh access is used with a provided username. What I've found is I can't do basic things I've been able to do with a fresh Linux VPS like the following:

sudo vim /etc/apache2/sites-available/000-default.conf 
[sudo] password for axel: 
Sorry, user axel is not allowed to execute '/usr/bin/vim /etc/apache2/sites-available/000-default.conf' as root on IT-DEV-SERVER.

I get similar messages when I try to use drush, drush dl drupal-7.34.

PS: Drush was installed via the root user account.

Can anyone help by enlightening me on how to grant users the necessary permissions for executing commands?

UPDATE:

@Arul: I found the following when I execute the visudo command:

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbi$

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL
rick ALL=(ALL;ALL) ALL
owen ALL=(ALL;ALL) ALL
axel ALL=(ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

Axel's "ALL" settings initially matched Sussies' and Rick's. I adjusted Axel's to match your answer but I still can't execute Drush. I could however use VIM with sudo.

2
  • It sounds like this is very dependent on how your hosting provider has configured the VPS, so contact them.
    – wurtel
    Feb 16, 2015 at 13:29
  • @wurtel: It isn't a VPS. It's an in house installation of Ubuntu on a spare computer for use as a testing server
    – sisko
    Feb 16, 2015 at 21:53

1 Answer 1

1

You need root access or request your system admin to allow sudo privilege to your user account 'axel'.

If you do have root access, log in as root and execute visudo command and enter the following at the end of the file to allow 'axel' user to be able to run vim with sudo.

axel  ALL = /usr/bin/vim

The above will only let you sudo to vim. You can give all permissions to 'axel' by adding the following line.

axel  ALL=(ALL) ALL

or to allow any group in addition, use the following entry

axel  ALL=(ALL:ALL) ALL
2
  • Thanks Arul. I provided feedback in an update to my question.
    – sisko
    Feb 16, 2015 at 16:57
  • @sisko , it sounds like it may be related to the users group, you can allow for any group as shown above (I added an entry to my original response above). NOTE: The entries you had (or still have) for owen and rick are incorrect--- the second part inside the '()' is group id and it needs to be separated by ':' not ';'.
    – Arul
    Feb 17, 2015 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.