[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Unable to execute a script without asking for sudo password, even after editing sudoers file.



On Ma, 01 apr 14, 01:38:43, Anubhav Yadav wrote:
> > The default ~/.profile on Debian already has:
> >
> >     # set PATH so it includes user's private bin if it exists
> >     if [ -d "$HOME/bin" ] ; then
> >         PATH="$HOME/bin:$PATH"
> >     fi
> >
> 
> I think I am really messed up in that situation. If I run 'echo $PATH'
> in a terminal session then this is the output that I get:
> 
> /home/neo1691/bin:/home/neo1691/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/bin:/home/neo1691/.rvm/gems/ruby-2.0.0-p451@global/bin:/home/neo1691/.rvm/rubies/ruby-2.0.0-p451/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/neo1691/.rvm/bin:/home/neo1691/bin:/home/neo1691/.rvm/bin:/home/neo1691/.rvm/bin
> 
> As you can see there is a lot of repetition over there.
> 
> So to be precise, I first used my ~/.bashrc file to export the PATH variable.
> export PATH=${PATH}:/home/neo1691/bin
> 
> I remember that when I did this, there was no file called .profile in my home
> directory. As I can see now, there exists one maybe because I installed rvm
> and maybe rvm created a .profile

Don't know what rvm is, but I'm quite sure it didn't create your 
~/.profile.
 
[sni[

> PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

But it did change yours. I don't like it when programs mess with my 
files.

> I also saw that there is a  ~/.bash_profile whose contents are
> 
> [[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
> 
> 
> [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" #
> Load RVM into a shell session *as a function*

But this one looks like created by rvm.

> > Now you just have to make sure whatever method you use to start X is
> > also sourcing ~/.environment.
> 
> There is no such file called ~/.environment
 
Sorry, my mistake, I meant ~/.profile. ~/.environment is where I keep 
environment variables and I source it from ~/.profile.

> Now I would really like to know as to what is the best
> practice to export a PATH variable?
 
That's a complicated question and depends a lot on what software you 
use.

> I mean as a linux user, I should know what happens when the
> operating system boots? What files are read? What are the uses of
> .xsession?
> .xinitrc?
> .profile?
> .bash_profile?
> .environment?

Scratch this one.

> /etc/X11/Xsession?

You forgot .xsessionrc :p

> And what changes when I use lightdm to startup my system?

If I recall correctly lightdm does not source ~/.profile, so I do it in 
~/.xsessionrc.

> And what again changes if I install replace my default shell
> from bash to zsh?

No idea, never used zsh.

> Right now what is happening is that I am not able to run the
> script i3exit with i3 window manager?
> 
> If I run this command:
> `tr '\0' '\n' </proc/$(pidof i3)/environ | grep PATH`
> 
> I get the output as:
> PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
> 
> And there is no mention of my local bin directory (~/bin)
> 
> So please guide me in this regards!

My way is to keep any environment variables I need to set/change in one 
place only and make sure it's used everywhere (i.e. console and X).

The logical place for that would be ~/.profile (or a file sourced in 
~/.profile to not clutter it), since that should be read on login.

Except that it's not read by some display managers so I had to use 
~/.xsessionrc for that.

Hope this explains,
Andrei
-- 
http://wiki.debian.org/FAQsFromDebianUser
Offtopic discussions among Debian users and developers:
http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic
http://nuvreauspam.ro/gpg-transition.txt

Attachment: signature.asc
Description: Digital signature


Reply to: