Trouble Executing Sudo Commands

I am trying to execute a sudo command on the terminal, everytime I try to do it it asks me for my password but when I attempt to type it in nothing happens (it does not even type it). Does anybody know why this is happening and how to fix it?
Thanks!

JavaFan2 wrote:
In fact, I help supervising a student project who is supposed to write an admin application to offert graphical interfaces for some security and system tools under Linux (like fdisk, iptables etc) using J2EE, ... something like Webmin.
As I said, I know that is has a huge security risk but this app has the only purpose of learning J2EE, no security issues are treated.If you want to say "I will leave my office door open because there's no security risk in doing that" then that's a valid statement. But what you are trying to do here isn't the equivalent of leaving your office door open. It's the equivalent of finding a master key for all the offices in the world. And as such it is in fact a serious security risk which should not be circumvented.
And no, it's no good saying "But I'm only going to use this all-powerful master key to open my own office door". If you get the key then anybody else can get the key too.

Similar Messages

  • Error executing sudo command

    When I try to execute a sudo command I get the following message:
    "sudo: /etc/sudoers is mode 0644, should be 0440
    Segmentation fault"
    What does it mean?
    Thanks for all the help.

    When I try to execute a sudo command I get the following message:
    "sudo: /etc/sudoers is mode 0644, should be 0440
    Segmentation fault"
    What does it mean?
    It means someone has incorrectly modified the /etc/sudoers file, and as a side effect its permissions were changed to an insecure form, so sudo refuses to use the file. It is also possible that the /etc/sudoers file syntax is also invalid, which might also cause the segmentation fault.
    'visudo' should be used to edit the /etc/sudoers file, which would have properly preserved the permissions, as well as verified that the updated /etc/sudoers file contained valid syntax so that sudo would continue to work. See 'man visudo'.
    You now have a problem, in that you can no longer use sudo to fix the permissions.
    You should first try booting your installation DVD. Via the Menu, you can run Disk Utility and run Repair Permissions. Hopefully this will repair the /etc/sudoers file. You could try running Applications -> Utilities -> Disk Utility, however, if it wants to use sudo to elevate its privileges, that would fail, as a broken /etc/sudoers file is still a broken /etc/sudoers file.
    If you have by any chance enabled the 'root' account, you could try logging in as root and fixing the /etc/sudoers file's permissions.
    You should also run visudo, so that the file's syntax is valid.
    I think you can use the Installation DVD to enable the root account. that might be another way to login as root.
    If repair permissions does not work, then maybe you can put your Mac into firewire target mode, mount your Mac's disk on another Mac via firewire, and repair the /Volume/Macintosh HD/etc/sudoers permissions from the working Mac.
    If that failes, the next step is booting your Mac in Single User mode. Search for "Single User Mode" in the forums, and you should find instructions on both booting, as well as how to make the root file system writable so you can change the permissions from single user mode.
    And if that does not work, I think you are left with reinstalling the OS.
    Message was edited by: BobHarris

  • Terminal automatically executes sudo command on opening?

    I am running Lion 10.7.5. I tried to execute a sudo command but remembered i did not have sudo privleges on my account so i logged onto the root user and executed it there. Getting back on my regular account i opened terminal but it automatically executed the sudo command again and if i exceeded the password attemp limit it just re executed the command and looped infinently. I now cannot use terminal on my account. I have deleted com.apple.Terminal.plist from its location and still nothing.

    Did you accidentally put a sudo command into one of the following files?
    .bash_profile
    .bash_login
    .profile
    .bashrc
    Or does one of the above files run a script that tries to execute sudo?
    If you cannot get a command prompt you can use Terminal -> Shell -> New Command to issue one command at a time.
    Message was edited by: BobHarris

  • Executing multiple commands with sudo fails

    Hi,
    We're having trouble with sudo and bash.  When we want to execute multiple commands and there are spaces, the commands don't run.  Here's an example of what works:
    [root@erpapp1-prod ~]# sudo -i -u oracle bash -c 'ls;pwd'
    In this case, I get a listing of the files in /home/oracle followed by the current directory of /home/oracle.
    Here's an example of what DOESN'T work:
    [root@erpapp1-prod ~]# sudo -i -u oracle bash -c 'ls; pwd'
    Notice the space before "pwd".  In this case, all I get is the listing of files in /home/oracle.
    Caveat:  I'm a real beginner with Linux.  I've compared many of the files (/home/oracle/.bash_profile, /home/oracle/.bashrc, /etc/bashrc, /etc/profile) from this server to another where we don't have issues and, other than some logic being in different order, don't see much of a difference.  Again, very beginner here.
    Any ideas?  Thanks!
    Todd

    What shows up as a space may not necessarily be a space. For instance, it could be some control character like a newline, which might interfere with the execution. For example:
    $ test=`echo -e "test;\ntest"`
    $ echo $test
    test; test
    $ echo "$test"
    test;
    test
    Here is another example:
    # test=`echo -e "ls;\npwd"`
    # su - oracle -c "$test"
    oradiag_oracle
    /home/oracle
    # su - oracle -c $test
    oradiag_oracle
    I cannot guess how you construct the command list. Perhaps the problem is a text files that was created under Windows and copied as binary to Linux, or a shell script using a different IFS environment variable, etc.
    Personally I would use a different approach. From a security standpoint it is a bad idea to use passwords at the command prompt because every user can see them using the ps -ef  output.

  • I am trying to install oracle 11g xe on ubuntu aws instance when i execute sudo /etc/init.d/oracle-xe configure command iam getting this error: sudo: /etc/init.d/oracle-xe : command not found

    i am trying to install oracle 11g xe on ubuntu aws instance when i execute sudo /etc/init.d/oracle-xe configure command iam getting this error: sudo: /etc/init.d/oracle-xe : command not found.

    "command not found" means ... there is no such thing.
    Has the .rpm been installed?
    http://docs.oracle.com/cd/E17781_01/install.112/e18802/toc.htm#XEINL122

  • Executing sudo linux commands through a JSP page.

    Hi,
    I need to execute some superuser commands through a JSP page under Linux.
    I added users apache and tomcat to the /etc/sudoers file with no password prompting.
    My JSP page works fine with any usual linux command, but when I call a “sudo cmd” I have a message (when reading the ErrorStream instead of the InputStream) that “sudo can’t be executed because it needs a tty” even when I call the shell before the sudo command.
    Here is a piece of my code (very basic):
    String cmd="linux_cmd";
    Process proc = Runtime.getRuntime().exec(cmd);
    InputStream stdin = proc.getInputStream();
    InputStreamReader isr = new InputStreamReader(stdin);
    BufferedReader br = new BufferedReader(isr);
    String line = null;
    while ( (line = br.readLine()) != null)
    out.println(line);
    Is there any way I can make sudo calls from a JSP page ?
    I know that making root calls from a web application is a bad thing, but for now security is not my concern.
    Thank you for any tips.

    JavaFan2 wrote:
    In fact, I help supervising a student project who is supposed to write an admin application to offert graphical interfaces for some security and system tools under Linux (like fdisk, iptables etc) using J2EE, ... something like Webmin.
    As I said, I know that is has a huge security risk but this app has the only purpose of learning J2EE, no security issues are treated.If you want to say "I will leave my office door open because there's no security risk in doing that" then that's a valid statement. But what you are trying to do here isn't the equivalent of leaving your office door open. It's the equivalent of finding a master key for all the offices in the world. And as such it is in fact a serious security risk which should not be circumvented.
    And no, it's no good saying "But I'm only going to use this all-powerful master key to open my own office door". If you get the key then anybody else can get the key too.

  • Sudo can't execute some commands[SOLVED]

    Hi Archers,
    I am using sudo and disable root account. There is some problems with sudo such as the following commands:
    #sudo echo "1234"  >/etc/rc.local
    # sudo cd /root
    I can't execute these commands with sudo, instead i have to login as root and execute the commands. So the question is how can I solve these problems?
    The Second issue is how can I give certain user the commands that they can execute. For example, user A is only allowed to use "ls" commands and not any other commands?
    Cheers
    Last edited by hungsonbk (2008-11-17 02:02:29)

    You can't use those commands because it aren't real commands, it are shell builtins and they are ran by your shell which is ran by your regular user.
    sudo echo foo > bar
    This runs the "echo" binary as root but the ">" part is handled by the shell, appropriate way to handle this:
    echo foo|sudo tee bar
    cd wont work neither, if it did you could cd to a directory you don't have permissions to and then you would be in their as regular user, unable to do anything... You should just work from outside /root or use sudo -s.
    For the user thing: man sudoers.
    Last edited by Ramses de Norre (2008-11-15 16:52:55)

  • How to run an executable from command-line

    I'm learning how to use the Terminal and I got stuck in a silly thing (I suppose it is). How can I run an executable file from command-line in Terminal?
    For example: I have a file named "Hello" in the folder /sample. If I use the ls command (ls sample), I can see the file Hello. Then I move to the directory (cd /sample) and try to run the file Hello (typing "Hello") but I got "command not found" message.
    If I drag the Hello file from Finder to Terminal and hit Return, it runs perfectly. And if I type the full path to the file (even if I'm already inside its directory), it also runs.
    So, my doubt is if there is any command to run an executable from command-line.
    Thanks

    KJK555 wrote:
    Hi VK:
    Can you enlighten me on why it's neccessary to do the "./" thingy in OS X when in unix/linux
    I never had to resort to doing that?
    Kj
    I took the trouble of reading *man bash* and it explains the issue. to add the current directory to PATH you need to add an empty path to PATH like this
    PATH=$PATH::
    you can add it to ~/.bash_profile so that it's executed automatically when you start bash. I suspect the linux system you are talking about had this set up by default or had it added to PATH in /etc/profile which defines PATH globally.

  • Sudo Command in Bash Script

    So I created a simple bash script to run on login.....
    one of the commands is the following:
    sudo "something something something"....
    One thing I haven't learned in my years of Unix is how do you get a bash script to run a sudo command without having to enter a password?  I know this is trival, but just a quick 'this is how you do it' would be cool.
    Thanks ahead of time on this really dumb question.

    There's a few ways to do this.  Here's two (pick the method you like):
    Method 1: Using "askpass".
    With this you always do sudo -A command.  The -A argument tells sudo to execute a command that echos the password to stdout.  That command is something you write.  For this explaination let's call the command pw and stick it /usr/local/bin.  So it's full pathname would be /usr/local/bin/pw.
    sudo -A can get the pathname to pw a number of ways.
    1. From the sudoers file.
    Use visudo to add the following line to the sudoers file:
    Defaults:ALL    askpass=/usr/local/bin/pw
    2. Using the SUDO_ASKPASS environment variable.
    export SUDO_ASKPASS=/usr/local/bin/pw
    This might work too (assuming SUDO_ASKPASS has been previously exported):
    SUDO_ASKPASS=/usr/local/bin/pw sudo -A command
    Method 2: Have sudo read the password from stdin
    echo -n password | sudo -S command
    The -S option tells sudo to read the password from stdin so echo pipes it in (without the ending newline).
    The only relatively secure scheme of these two methods is the askpass (-A) method.  At least with that method you have a chance of encrypting/hiding your password down in the command that echoes it to stdout.  The -S method would contain your password explicitly in a script somewhere unless you make other provisions to encrypt/hide it with that technique.

  • Help with executing windows command in java

    hi, i am trying to execute dos command in java. currently i am trying simply to create a folder in the current directory.
    here is the code snippet:
    try {
    Process p = Runtime.getRuntime().exec("md myFolder");
    } catch (IOException io) {
    io.printStackTrace();
    i have also tried using "mkdir" instead of "md". but my code just throws an exception that says:
    java.io.IOException: CreateProcess: md myFolder error=2
    what have I done wrong? thanks in advance

    try {
    Process p = Runtime.getRuntime().exec("cmd /c
    mkdir myFolder");
    catch (IOException io) {
    io.printStackTrace();hey! that code worked out perfectly. so "cmd" is needed to run dos commands? i searched through the net, but most of the examples that i were able to find did not include "cmd".
    if it wouldn't be too much trouble, what is the option "/c" for?
    i would also like to add that "mkdir" also works. The problem was the missing "cmd /c". Thanks guys for your help! I really appreciate it.

  • Terminal doesn't understand sudo command

    I am installing MacPorts 1.7.0 from a .dmg file. Following, I set up the environment variables in the .profile file, and tried to use Terminal to update using the sudo port selfupdate command from Terminal.
    This is the result I got:
    -bash: sudo: command not found
    Why is this, and what can I do?

    I think the error refers to the command(s) following "sudo." Were you prompted for your password?
    No, that would be:
    sudo fred
    Password:
    sudo: fred: command not found
    But if the command bash is asked to execute is not found you get
    fred
    -bash: fred: command not found
    So I think he is not finding sudo.
    That makes me think that PATH has been messed up, because sudo is in /usr/bin/sudo which is always in PATH unless it has been messed up. Which makes me think that .profile was properly executed, and that is how PATH got messed up.
    So I would look very closely at .profile and make sure PATH is setup correctly. I would expect it to looks something like:
    export PATH="$PATH:/opt/local/bin"

  • Getting a fatal relocation error while using a sudo command.

    I am getting the following error while trying to execute a sudo command:
    ld.so.1: sudo: fatal: relocation error: file /usr/local/bin/sudo: symbol closefrom: referenced symbol not found
    the sudo version I use is: 1.6.8p9
    the SUNWcsu package that contains the ld.so.1 library is version: 11.8.0,REV=2000.01.08.18.12
    any ideas?

    Just had the same error
    ld.so.1: sudo: fatal: libintl.so.8: open failed: No such file or directory
    Killed
    was solved by adding the Dependances
    libintl-3.4.0-sol10-sparc-local.gz Libintl is used with gettext and is needed by a few programs when libintl in not in /usr/lib - installs in /usr/local/lib. The 3.4.0 package number indicates that this provides /usr/local/lib/libintl.so.3.4.0 (and also the new /usr/local/lib/libintl.so.8.0.2). Dependencies: libiconv and to have /usr/local/lib/libgcc_s.so.1 and /usr/local/lib/libstdc++.so.6, either the libgcc-3.4.6 or gcc-3.4.6 packages.
    http://www.sunfreeware.com/indexsparc10.html

  • What do the following SUDO-Commands mean and do?

    Hey Everybody,
    I did google these two commands but I cannot find a straight answer which is understandable for me. Can someone please explain to me in plain English what they do?
    1. "sudo chmod -RN ~"
    2. "sudo chown -R `id -un` ~"
    My second question is: After I have executed these 2 commands, will there be a problem or danger to my system if I won't boot up off the Leopard DVD and click the "Reset" button in the "Reset Home Directory Permissions and ACLs" section? Because this reset seems not possible on my machine.
    Thank you very much for your answers!
    AirMcEnroe

    I'll start off by asking if you have a problem that you are trying to solve, or if you are just having fun with Google? The sudo command is a very dangerous command, and using the -R option allows the computer to multiply your mistakes with amazing speed.
    I did google these two commands but I cannot find a straight answer which is understandable for me. Can someone please explain to me in plain English what they do?
    1. "sudo chmod -RN ~"
    sudo says run the following command as if you were the super user (the all powerful). It will prompt for your password (assuming you are an 'admin' user). You will see nothing while typing the password.
    chmod is used to change file permissions (see "man chmod").
    The tilda ~ says start with your home directory.
    -R says recursively process every file and directory under the specified starting directory (in this case you specified ~ your home directory).
    -N says remove any Access Control Lists (ACL) found.
    Not sure why you want to do this. It seems like a very big hammer and some of those ACLs may be service a valuable function, such as protecting you from shooting yourself in the foot, or enabling specific needed permissions on newly created files, etc...
    And if you happen to fumble finger entering the starting directory ~, you could destroy ACLs outside of your home directory tree and destroy critical OS ACLs.
    Make sure you have a very good full system backup before you take aim at your foot.
    2. "sudo chown -R `id -un` ~"
    chown changes the ownership of files and directories.
    -R says recursively process every file and directory under the specified starting directory (in this case you specified ~ your home directory).
    `id -un` obtains your short username, the `...` says substitute the output from id -un onto the chown command line.
    So this command is going to walk your home directory tree and change the ownership of every file and directory it finds and force you to be the owner.
    Again a very big hammer, and one that if you specify the wrong starting directory will turn your Mac into a paper weight. Make sure you have a very good full backup before you start.
    My second question is: After I have executed these 2 commands, will there be a problem or danger to my system if I won't boot up off the Leopard DVD and click the "Reset" button in the "Reset Home Directory Permissions and ACLs" section? Because this reset seems not possible on my machine.
    By the way, Terminal, Unix, X11, and command line command, ssh, rsync, etc... questions are best asked in the Mac OS X Technologies > Unix Forum
    <http://discussions.apple.com/forum.jspa?forumID=735>

  • Diff. among sudo commands

    I do not quite understand the difference among some switching user commands.
    -- waht's the diff between su and sudo command
    -- there are multiple format of sudo command:
    sudo bash
    sudo - su
    What are the difference?
    Thanks

    The sudo command allows a permitted user to execute a command as the superuser or another user, as specified in the sudoers file. Using the sudoers file, system administrators can give certain users or groups access to some or all commands without those users having to know the root password. By default, sudo requires that users authenticate themselves with their own password, not the superuser or root password. Once a user has been authenticated, a timestamp is updated and the user may then use sudo without a password for 5 minutes unless overridden in sudoers.
    The su command stands for "switch user", and allows you to become another user. If you don't provide a user, the su command defaults to the root account. From what I understand, "sudo - su" doesn't make sense, you probably mean "sudo su -", which will put you into a root environment, but it will ask you for your user password instead of the root password.

  • Run a sudo command on system startup via Applescript?

    Hey, I'm trying to hide the Spotlight icon on my menu bar using the sudo command shown here:
    http://osxdaily.com/2011/12/12/hide-spotlight-menu-icon-mac-os-x-lion/
    It works fine, but when I reboot my Mac (I tend to turn it off at night since it has a habit of waking from sleep by itself) the icon has re-appeared, and I need to run the command again.
    I'd ideally like to write an Applescript to run on launch to execute the two commands (which also requires entering my password), but I've not been successful, I get various errors talking about authentication and such.
    Is there an easier way to get this icon permanently hidden? I use Alfred, so while I make use of the Spotlight index, I never touch the magnifying glass icon, and I like to keep a clean menu bar!

    You don't need applescript. What you need to create is a LaunchAgent. Lingon (available through the App Store) can help you write it. But, there are other sources that can show you how to write the raw file and put it in the LaunchAgents folder, like here: http://www.devdaily.com/mac-os-x/launchd-examples-launchd-plist-file-examples-ma c

Maybe you are looking for

  • Preview seems odd in the fullscreen mode (Yosemite)

    The text color seems have some sort of auto adjustment feature, and this make things worse. I hope Apple could fix it.

  • Where Can I Get a Zen Xtra 60 GB Case/Pouch With Window??!!!!!!!

    I've searched endlessly! Creative does not have any in stock so I used the ''notify me when available'' option. And sadly, after writing to Creative's customer support, I was told that they don't even know when the will get more of these in stock. Eb

  • How to find RETRO in a given period

    Dear freinds,              Iam doing a payroll report relating to bonus,i would like to check in my coding the retro caculation , iam not sure how we should check the retro calcuation . IF any function module is there where we can check after reading

  • Scroll bar maths?!

    I have the code below that i am looking to try to amend to use my custom scroller, any one able to help me figure out what code i need to know to make it work for me properly? using it in its current state it does move the bar up and down, and displa

  • HttpSessionResponse response

    I have a redirect servlet that does redirect to the correct servlet based on the user input. The problem I am having is that I am unable to get the values passed from the original html page to the redirect servlet to the subsequent servlet. According