Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to this sudo command. I needed to do sudo mount -o remount. But it is giving me the following message

sudo: unable to stat /etc/sudoers: No such file or directory
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

So I assume, it is not installed on my server. Could anyone give me instructions on how to properly install the sudo package on my server. I followed this tutorial [http://www.linuxfromscratch.org/blfs/view/svn/postlfs/sudo.html][1]. But I am not able to login as a root and run command make install.

My actual problem is: I have phpseclib installed on /usr/share/pear. I want to send some file using phpseclib from one website to another one.(I'll generate pdf files on website1 and send pdf files to website2) I have a test.php outside of wordpress, it works perfectly (mean by I can see contents of website2 using ssh on website1). But then I have a wordpress page, it has exact same code, it said it failed to open library. I asked on other stackoverflow question and the member said because /usr/share/pear only allow root to access. As a wordpress user, I don't have a privilege. So that is why am I here and was trying to gain root access.

share|improve this question

closed as unclear what you're asking by jasonwryan, slm, Anthon, rahmu, Michael Kjörling Dec 4 '13 at 13:50

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

Wrong question: you have sudo installed, but it's not configured to do anything useful. Sudo is a common way of executing commands as root, but not the only one. You need another way to gain root (if only because that's necessary if you want to set up sudo). What distribution is this? – Gilles Dec 3 '13 at 23:54
As @Gilles said, you have sudo installed, but you need root access to modify the /etc/sudoers file to grant permission to your userid to run the mount command. – ChuckCottrill Dec 4 '13 at 0:03
What are the other ways to gain access to root? What is distribution? Sorry I am not familiar with it. I just have web server and web site running on wordpress. I installed phpseclib on /usr/share/pear. But my wordpress page cannot access since it said only root can access it. I have test.php outside of worpress, it can access my phpseclib just fine. – user2090076 Dec 4 '13 at 0:04
@user2090076 a few examples of distributions: Ubuntu, Debian, Red Hat (aka RHEL), CentOS, OpenSUSE... the list goes on. if you really don't know, run lsb_release (it it's available) or cat /etc/*-release, which should give you a hint. – strugee Dec 4 '13 at 6:36
Please post the output of lsb_release -ic, that should tell us what system you are running, if the command does not exist, that will also narrow things down. – terdon Dec 4 '13 at 18:53
up vote 3 down vote accepted

When you have an account on a unix system, there are two main ways to gain administrative privileges:

  • with su, which requires knowing the password to the root account;
  • with sudo, which requires having prior authorization and typing your account's password.

Many variations are possible (other tools, other authentication methods), but if you haven't configured anything special, one of these is likely to work. Depending on the distribution, su or sudo may be the default way.

If you're using the command line, you can type:

  • su -c 'somecommand' or sudo somecommand to execute a command as root;
  • su or sudo -s to execute a shell as root;
  • su - or sudo -i to execute a shell as root, with root's initialization files.

GUI environments have ways to run commands as root by invoking su or sudo under the hood and prompting the user for a password in a dialog box.

If sudo tells you “no valid sudoers sources found”, it means that the sudo program is installed, but not configured. You won't be able to use it until you've configured it, and you need root access for that. Always run the visudo command to set up sudo, never try to edit its configuration file directly. Before running visudo, make sure that you've configured your default editor — check that the value of the VISUAL environment variable is something you're comfortable with (if unset, it may default to vi), e.g. export VISUAL=nano.

To gain root access, run su and type the root password. It is rare for su to be disabled. Many systems make su to root inoperative indirectly, by not having a root password.

Since sudo isn't set up, it's highly likely that su is. If it isn't, this is an unusual set up; check your hosting provider's documentation or contact their support.

share|improve this answer
I am getting this message visudo: /etc/sudoers: Permission denied – user2090076 Dec 4 '13 at 4:56
@user2090076 You need to run this as root, of course. Your first step is to figure out how to get root access. If you need help with that, read your hosting provider's documentation or contact their support. We really can't help you more without more information from you. – Gilles Dec 4 '13 at 9:49
I contacted my hosting provider, but they said my web site is running on shared server, so I cannot have a root access. That means do I need to have dedicated server? – user2090076 Dec 4 '13 at 18:31
@user2090076 Indeed, on a shared server, you wouldn't get root access. I can't tell you whether you need to have a dedicated server: you never said why you really needed to have root access. You should ask a new question, explaining what you need to do with /usr/share/pear. Tell us what you tried (copy-paste commands, file contents, etc.), what happened (copy-paste error messages, etc.), and what you wanted to happen instead. – Gilles Dec 4 '13 at 18:49
@user2090076 Ask a new question. (This may be a question for WordPress Development rather than Unix & Linux, I don't know whether the software you're having problems with is part of Wordpress.) Be sure to give all the facts (you wrote a lot more in your comment here than in your question). Link to the SO question, too. – Gilles Dec 4 '13 at 19:08

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