Jump to content

Can't access path with sudo

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
12 replies to this topic

#1
Kousuke

Kousuke

    Newbie

  • Members
  • PipPip
  • 14 posts
Hi,

I messed up my /etc/sudoers file
which left me with an incomplete one
can someone check if this is right?
i've put my user in the admin group
and gave it all access rights

# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#

Defaults env_reset
# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root ALL=(ALL) ALL
# Uncomment to allow members of group sudo to not need a password
# (Note that later entries override this, so you might need to move
# it further down)
# %sudo ALL=NOPASSWD: ALL

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



#2
marwex89

marwex89

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 10,720 posts
EDIT: forget it..

But still, make sure you use "visudo" to edit the file

What is your problem, anyway?
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

#3
Kousuke

Kousuke

    Newbie

  • Members
  • PipPip
  • 14 posts
edit1: sorry thats to long :p
I'll make a better post :p

#4
Kousuke

Kousuke

    Newbie

  • Members
  • PipPip
  • 14 posts
edit2:
sorry, i'll explain better

i'm trying to cross-compile glib

as super-user I can cross-compile
but I can't if I use sudo as a user
the path is found with super-user
but not with sudo
still the paths are the same
the path I use is
/opt/mingw/usr/bin

#5
marwex89

marwex89

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 10,720 posts
What exactly are you typing?
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

#6
Kousuke

Kousuke

    Newbie

  • Members
  • PipPip
  • 14 posts
sudo ./configure --host=i686-pc-mingw32

edit:
the value of PATH:
/opt/mingw/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/games

where /op/mingw/usr/bin is the cross-compiler binaries

#7
marwex89

marwex89

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 10,720 posts
And you get what in response?
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

#8
Kousuke

Kousuke

    Newbie

  • Members
  • PipPip
  • 14 posts
ofcourse :p

checking for i686-pc-mingw32-gcc... no
checking for gcc... gcc
......
checking for i686-pc-mingw32-windres... no
checking for windres... no
configure: error: *** Could not find an implementation of windres in your PATH.

while in super-user both mingw32 are true

#9
marwex89

marwex89

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 10,720 posts
Aha. Well, when using sudo you don't get root's path. Maybe that's the issue? Try comparing

echo $PATH

as root

with

sudo env | grep PATH

as your other user.
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

#10
Kousuke

Kousuke

    Newbie

  • Members
  • PipPip
  • 14 posts
super-user
/opt/mingw/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

sudo with user
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin

:closedeyes:

indeed, in this PATH it doesn't have the cross-compiler listed

edit 1:
So, what's the right way to add it to this PATH?

#11
marwex89

marwex89

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 10,720 posts
Depends. If I remember correctly, sudo will use its own path if built with the --secure-path option (or something like that). So if you are running e.g. Ubuntu (which does this), that would be a problem.

In any case you would have to set the user's path to the same as root's. If that doesn't work, try

sudo -i
or

sudo env PATH=$PATH
You can add an alias to the last one if you wish to make the solution permanent. Up to you.
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

#12
Kousuke

Kousuke

    Newbie

  • Members
  • PipPip
  • 14 posts
I've done it ^^

debian doesn't want you to use PATH Variables
and suggest to write a wrapper script

with some trial and error I made a working script that export PATH
en launches configure