Hello all, i’m new to opensuse and i’m having some problems starting with it.
When i try to run some commands with sudo (visudo, modinfo, nstat…) it always says me “command not found” and i don’t know whats happen. I think my sudoers file is right.
And i don’t know if it is related, but i can’t mount any ntfs drive i have. It says me that i have to review the permissions configuration.
Any one have any idea about what can i do to fix this? I’ve found this and this post here, but none of these help me.
This is my sudoers file:
sudoers file.
This file MUST be edited with the ‘visudo’ command as root.
Failure to use ‘visudo’ may result in syntax or file permission errors
that prevent sudo from running.
See the sudoers man page for the details on how to write a sudoers file.
Host alias specification
User alias specification
Cmnd alias specification
Defaults specification
Prevent environment variables from influencing programs in an
unexpected or harmful way (CVE-2005-2959, CVE-2005-4158, CVE-2006-0151)
Defaults always_set_home
Defaults env_reset
Change env_reset to !env_reset in previous line to keep all environment variables
Following list will no longer be necessary after this change
for the first user you set up via the installation dialog sudo definitly should work,
could you please post such an sudo dialog you do, i mean the whole terminal dialog like:
It may be that the commands you are trying to run are not in your $PATH.
From your /etc/sudoers, it is obvious that you have modified it a great
deal, any reason why?
From what I can tell you have said anyone can use sudo with their own
password; possibly a slight security risk.
As you have ‘ALL ALL=(ALL) ALL’, ‘myusername ALL=(ALL) ALL’ isn’t
doing anything.
I would uncomment ‘Defaults targetpw’
and comment out ‘myusername ALL=(ALL) ALL’
Then check if it is simply a $PATH issue.
On 07/22/2010 04:59 PM, Barry Nichols wrote:
> Hi,
>
> It may be that the commands you are trying to run are not in your $PATH.
> From your /etc/sudoers, it is obvious that you have modified it a great
> deal, any reason why?
>
> From what I can tell you have said anyone can use sudo with their own
> password; possibly a slight security risk.
> As you have ‘ALL ALL=(ALL) ALL’, ‘myusername ALL=(ALL) ALL’ isn’t
> doing anything.
>
> I would uncomment ‘Defaults targetpw’
> and comment out ‘myusername ALL=(ALL) ALL’
> Then check if it is simply a $PATH issue.
On openSUSE, an unprivileged user does not have /sbin or /usr/sbin in their path
for reasons of security. Thus you need to do “sudo /sbin/modprobe”, etc.
Barry_Nichols: the changes in sudoers are tests trying to fix the problem. If I restore it uncommenting “Defaults targetpw” and commenting out “myusername ALL=(ALL) ALL” I still have the same message:
myusername@viskovitz:~> sudo visudo
root’s password:
sudo: visudo: command not found
myusername@viskovitz:~>
and if I add ‘/usr/sbin’ and ‘/sbin’ to the path sudo works fine and when I try to run any of the commands in these folders (without sudo) it ask me for superuser privileges:
myusername@viskovitz:~> modinfo
Absolute path to ‘modinfo’ is ‘/sbin/modinfo’, so running it may require superuser privileges (eg. root).
myusername@viskovitz:~>
My question is if is safe to do this in the path of a normal user?
Those programs will not let you do root operations if you are not really root. Unix/Linux is not that flimsy to rely on “hiding” programs in directories so that normal users won’t “find” them. However some of them are still useful to non-root users, e.g. modinfo can still show normal users information about a module, ifconfig can show normal users details about network interfaces. So the only danger really is yourself, do you trust yourself not to accidentally run a program as root under sudo and change something you didn’t intend to?
[/QUOTE]
As you mentioned sudo -i <command> works, what’s the problem?
[/QUOTE]
So (someone please correct me if iam wrong),
well, waht suso only does is executing a script/programm as the super user, it does not change your path to the programms only root should use (such as /usr/sbin/visudo), while sudo with the -i option makes you root, so it does something like the same su does before, it makes you roote, i think the -s option should work the same way. So with this -i (interactive i guess) option you first become root and than executes a script.
I agree with ken_yap, there’s a number of commands hidden behind /usr/sbin/ and /sbin/ usually not available to normal users for security reasons.
AFAIK an inheritance from the UNIX multiuser operating system the original model for the Linux operating system. Original UNIX had a Root administering for all user accounts, etc. Linux Desktop tends to be more single user system with less emphasis on root administrators, server and multiuser systems excluded. With desktop Linux, anyone accessing your PC, has access to root commands in /sbin/ and /usr/sbin/ because these are in your path.
AFAIK, unless you are root, use “su”, “su -l”, “su -c command” or “sudo command” you shouldn’t be allowed to execute commands in /sbin/ or /usr/sbin/.
I’m fairly sure, that’s why you saw the message
myusername@viskovitz:~> modinfo
Absolute path to 'modinfo' is '/sbin/modinfo', so running it may require superuser privileges (eg. root).
myusername@viskovitz:~>
In that same message it’s telling you the path to the command was /sbin/modinfo
I code /sbin/ and /usr/sbin/ in my userid path statement.
Ok, I think I understand your explanations. I’ll try to work this way in a time, (with /usr/sbin and /sbib out of my userid path). I come from ubuntu and I’ve work in other way before…
For some commands that may be useful for a normal to run without needing root privilege, e.g. ifconfig and modinfo, what I do is symlink it to my ~/bin and then it’s available to me without sudo.
So just because the command not found message says that a command is in /usr/sbin and may require root permission to run, doesn’t mean it has to be run as root. You can just run it without root privilege.