LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-24-2007, 03:20 PM   #1
ScSpruijt
LQ Newbie
 
Registered: Apr 2007
Posts: 4

Rep: Reputation: 0
Classpaths don't work with sudo -s


Hello all,

I have a slight problem with classpaths. The problem is that they won't work when I'm working as root with "sudo -s". This gives me the same rights as root but somehow the classpaths don't transfer with it. Any idea on how to fix this? I'd hate to really log in as root everytime a classpath doesn't work.

Thanks
 
Old 04-24-2007, 04:12 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
sudo su -

That should give you the full path and environment that root has. And what do you mean, login as root? Using sudo -s is logging in as root, it's just not giving you want you want.
 
Old 04-24-2007, 05:34 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Try sudo -i
 
Old 04-24-2007, 06:00 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
I think the OP has some environment variables (CLASSPATH) set in his shell and then attempts to execute something (a java app) that requires that. The only problem being that the shell (from -s) probably adjusts the environment somewhat.

On my system, the following works fine:
Code:
CLASSPATH="xxx" sudo -s
echo $CLASSPATH
I still get xxx as output.

The following might work, though:
Code:
CLASSPATH="xxx" sudo bash -c 'echo $CLASSPATH'
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: The Ultimate Sudo FAQ — To Sudo Or Not To Sudo? LXer Syndicated Linux News 13 04-13-2013 01:36 AM
setting classpaths:?? trscookie Programming 3 06-18-2006 06:10 AM
Adding Java Classpaths indienick Programming 2 06-15-2006 07:24 AM
sudo doesn't work mla Linux - Software 1 10-01-2003 08:24 PM
sudo doesn't work mla Linux - Software 4 10-01-2003 07:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration