Re: [CentOS] root .bash_profile?

2019-05-14 Thread John R. Dennison
On Tue, May 14, 2019 at 10:23:20AM -0400, Bee.Lists wrote:
> 
> Second, if you READ the posts, you would find that the man page, is
> unclear.  It was referred to, but you missed that as well.  

No, it's really not.  This is reinforced by the fact that you are the sole
person having an issue grasping how this all works and would rather
argue your incorrect point of view (and getting the last word in) than
accept that you might be wrong and others might be right.  The people
that have chimed in have a combined experience of _well_ over a hundred
years.  Might just be they know a thing or 10?

If you find the man page confusing for whatever reason there is a SEE
ALSO section that points you to the GNU info page for it, including the 
exact command line necessary to see the invocation specifics; GNU info
pages are generally far more fleshed out than man pages.  You might need
to install the info package but it may be worth it for the additional
information source.

> It’s really hard to post things when people like you two don’t read
> the frickin posts.  No matter how many times you post, most people
> just want to fluff their feathers instead of read the posts.  

This argumentative nature you are displaying is not going to make people
want to help you further.

> I would suggest…reading the posts.  Then, read the posts.  Or get some
> fresh air.  None of this is difficult.

I would encourage you to do the same with a bit more open mind and the
understanding that perhaps, just maybe, when you come to a support list
asking for assistance that the assistance you get might actually be,
shocking as it may seem, correct.





John

-- 
If people did not do silly things, nothing intelligent would ever get done.

-- Ludwig Wittgenstein (1889-1951), Austrian-born philosopher,
   Culture and Value (1980)
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-14 Thread Bee.Lists


> On May 14, 2019, at 10:23 AM, Valeri Galtsev  
> wrote:
> 
> Look, in the following four command lines executed in the shell:
> 
> su
> 
> su fred
> 
> su - fred
> 
> su -l fred
> 
> - in all four of them:
> 
> "su" is a command
> 
> "fred" is an argument (wherever it is present)
> 
> "-" (surrounded by spaces on both sides) and "-l" are command options
> 
> This is standard terminology used in UNIX, Linux, etc for several decades. 
> And finally, RTFM, please.
> 
> And also, can we close this thread, please.


Just wow.  No point in even posting in here anymore.  



Cheers, Bee




___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-14 Thread Valeri Galtsev



On 2019-05-14 09:07, Bee.Lists wrote:



On May 14, 2019, at 8:14 AM, Jonathan Billings  wrote:

On Tue, May 14, 2019 at 07:45:55AM -0400, Bee.Lists wrote:

I addressed this in the thread.


And we continue to tell you that you're wrong.  su behaves the same
way when switching to any other user as it does for root.  Stop
spreading misinformation.


Not big on reading what I put.  It’s all there.  Regardless how often you say 
‘su’ is the same as ‘su fred’, it is not.  Stop spreading misinformation.



Look, in the following four command lines executed in the shell:

su

su fred

su - fred

su -l fred

- in all four of them:

"su" is a command

"fred" is an argument (wherever it is present)

"-" (surrounded by spaces on both sides) and "-l" are command options

This is standard terminology used in UNIX, Linux, etc for several 
decades. And finally, RTFM, please.


And also, can we close this thread, please.

Valeri



Cheers, Bee




___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos



--

Valeri Galtsev
Sr System Administrator
Department of Astronomy and Astrophysics
Kavli Institute for Cosmological Physics
University of Chicago
Phone: 773-702-4247

___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-14 Thread Bee.Lists

> On May 14, 2019, at 10:13 AM, Valeri Galtsev  
> wrote:
> 
> Sorry, Jonathan, that I replying _your_ message, my reply has nothing to do 
> with it of any of your other posts, but rather with some posts by some other 
> posters. I really have to say this:
> 
> This whole thread - some posts in it that is - reminds me the old truth: 
> RTFM. Namely, Read The F.. (damn) Manual!
> 
> It is really hard to help those who don't care to read the man page. No 
> matter how many times you repeat that su stands for "substitute user", and 
> that the command as usually may have various options, and "-" is one of these 
> options, and what is the difference between invoking command with or without 
> it.
> 
> I would suggest that continuing this thread is counter-productive.

Then reply to them.  Is it that hard?  

Second, if you READ the posts, you would find that the man page, is unclear.  
It was referred to, but you missed that as well.  

It’s really hard to post things when people like you two don’t read the frickin 
posts.  No matter how many times you post, most people just want to fluff their 
feathers instead of read the posts.  

I would suggest…reading the posts.  Then, read the posts.  Or get some fresh 
air.  None of this is difficult.


Cheers, Bee




___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-14 Thread Valeri Galtsev




On 2019-05-14 07:14, Jonathan Billings wrote:

On Tue, May 14, 2019 at 07:45:55AM -0400, Bee.Lists wrote:

I addressed this in the thread.


And we continue to tell you that you're wrong.  su behaves the same
way when switching to any other user as it does for root.  Stop
spreading misinformation.



Sorry, Jonathan, that I replying _your_ message, my reply has nothing to 
do with it of any of your other posts, but rather with some posts by 
some other posters. I really have to say this:


This whole thread - some posts in it that is - reminds me the old truth: 
RTFM. Namely, Read The F.. (damn) Manual!


It is really hard to help those who don't care to read the man page. No 
matter how many times you repeat that su stands for "substitute user", 
and that the command as usually may have various options, and "-" is one 
of these options, and what is the difference between invoking command 
with or without it.


I would suggest that continuing this thread is counter-productive.

Valeri

PS pasting excerpt from "man su" on my FreeBSD workstation:

SU(1)   FreeBSD General Commands Manual 
SU(1)


NAME
 su - substitute user identity

SYNOPSIS
 su [-] [-c class] [-flms] [login [args]]

...

 -l  Simulate a full login.  ...


 -   (no letter) The same as -l.

--

Valeri Galtsev
Sr System Administrator
Department of Astronomy and Astrophysics
Kavli Institute for Cosmological Physics
University of Chicago
Phone: 773-702-4247

___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-14 Thread Bee.Lists

> On May 14, 2019, at 8:14 AM, Jonathan Billings  wrote:
> 
> On Tue, May 14, 2019 at 07:45:55AM -0400, Bee.Lists wrote:
>> I addressed this in the thread.  
> 
> And we continue to tell you that you're wrong.  su behaves the same
> way when switching to any other user as it does for root.  Stop
> spreading misinformation. 

Not big on reading what I put.  It’s all there.  Regardless how often you say 
‘su’ is the same as ‘su fred’, it is not.  Stop spreading misinformation.  


Cheers, Bee




___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-14 Thread Jonathan Billings
On Tue, May 14, 2019 at 07:45:55AM -0400, Bee.Lists wrote:
> I addressed this in the thread.  

And we continue to tell you that you're wrong.  su behaves the same
way when switching to any other user as it does for root.  Stop
spreading misinformation. 

-- 
Jonathan Billings 
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-14 Thread Bee.Lists

> On May 14, 2019, at 6:06 AM, Pete Biggs  wrote:
> 
>> OK I think you need to read previous posts on this. 
>> 
>> I’m not looking for any other command.  
> 
> How are 'su' and 'su -' different commands?
> 
> If you really dislike typing the extra " '-'", then setup an
> alias so you only have to type "'s' 'u'" to get it to do what you want.
> 
> P.

If you look, they are not the same.  One has a parameter.  My fix was to park 
the source into .bashrc and it now works.  



Cheers, Bee




___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-14 Thread Bee.Lists


> On May 14, 2019, at 6:02 AM, Pete Biggs  wrote:
> 
> su is NOT the same as logging in with that user ID.  If you login as
> root at the console, root's .bash_profile would be read.

I can count those instances on one hand over the last 40 years.  Hence the 
question of switching from another user.  I covered that in the thread. 

Cheers, Bee




___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-14 Thread Bee.Lists

> On May 14, 2019, at 5:50 AM, John R. Dennison  wrote:
> 
> On Tue, May 14, 2019 at 05:19:57AM -0400, Bee.Lists wrote:
>> OK I think you need to read previous posts on this. 
>> 
>> I’m not looking for any other command.  
> 
> Please stop top-posting, thank you.
> 
> It's the _same command_; all it is is a different invocation method
> using an additional argument.
> 
> 
> 
> 
>   John
> -- 
> We're not ending the journey today, we're completing a chapter of a journey
> that will never end.  Let's light this shuttle one more time ... and
> witness this nation at its best.  The crew of Atlantis is ready to launch.
> 
> -- Atlantis Commander Chris Ferguson, just before the 11:29:29am EDT
>   launch of STS-135, the final Space Shuttle mission, 8 July 2011
> ___
> CentOS mailing list
> CentOS@centos.org
> https://lists.centos.org/mailman/listinfo/centos


I addressed this in the thread.  


Cheers, Bee


___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-14 Thread Pete Biggs
On Tue, 2019-05-14 at 05:19 -0400, Bee.Lists wrote:
> OK I think you need to read previous posts on this. 
> 
> I’m not looking for any other command.  

How are 'su' and 'su -' different commands?

If you really dislike typing the extra " '-'", then setup an
alias so you only have to type "'s' 'u'" to get it to do what you want.

P.


___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-14 Thread Pete Biggs
On Tue, 2019-05-14 at 04:50 -0400, Bee.Lists wrote:
> su does not load .bash_profile and therefore is a completely
> different application than with any other user.  This one is
> different, considering .bash_profile is indeed used for logins for
> other users.  

su is an application for switching from one user to another. It behaves
the same way whether you are switching from user A to user B, or to
user root.

su is NOT the same as logging in with that user ID.  If you login as
root at the console, root's .bash_profile would be read.

P.


___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-14 Thread John R. Dennison
On Tue, May 14, 2019 at 05:19:57AM -0400, Bee.Lists wrote:
> OK I think you need to read previous posts on this. 
> 
> I’m not looking for any other command.  

Please stop top-posting, thank you.

It's the _same command_; all it is is a different invocation method
using an additional argument.




John
-- 
We're not ending the journey today, we're completing a chapter of a journey
that will never end.  Let's light this shuttle one more time ... and
witness this nation at its best.  The crew of Atlantis is ready to launch.

-- Atlantis Commander Chris Ferguson, just before the 11:29:29am EDT
   launch of STS-135, the final Space Shuttle mission, 8 July 2011
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-14 Thread Bee.Lists
OK I think you need to read previous posts on this. 

I’m not looking for any other command.  


> On May 14, 2019, at 5:10 AM, John Hodrien  wrote:
> 
> You misunderstand.  su behaves the same when switching to root as to any 
> other account.
> 
> su -
> 
> is probably the command you're looking for.



Cheers, Bee




___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-14 Thread John Hodrien

On Tue, 14 May 2019, Bee.Lists wrote:


su does not load .bash_profile and therefore is a completely different 
application than with any other user.  This one is different, considering 
.bash_profile is indeed used for logins for other users.


You misunderstand.  su behaves the same when switching to root as to any other 
account.

su -

is probably the command you're looking for.

jh
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-14 Thread Bee.Lists
su does not load .bash_profile and therefore is a completely different 
application than with any other user.  This one is different, considering 
.bash_profile is indeed used for logins for other users.  

> On May 13, 2019, at 5:25 PM, Pete Biggs  wrote:
> 
>> 
>> man su doesn’t apply to root with regards to the files loaded up upon
>> login. 
> 
> Could you explain what you mean by that.



Cheers, Bee




___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-14 Thread Bee.Lists
But it is different.  Significantly different. 

I’d rather just use ‘su’ and have the login sequence trip the loading of my 
aliases.  Moving this to .bashrc has solved that.  That’s what I was asking.  



> On May 13, 2019, at 4:37 PM, Jonathan Billings  wrote:
> 
> The 'su' man page explains all of this pretty well I think.  Becoming
> root isn't special, in terms of loading .bash_profile vs. .bashrc.



Cheers, Bee




___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-13 Thread Pete Biggs


> Shame that "security experts" regularly recommend using another name for
> the root account - security through obscurity anyone?
> 

Unfortunately anyone can call themselves an "expert".

If your protection against a UID 0 login is to change the username,
then you need to seriously look at (a) your password policy and (b)
letting root login in the first place.

P.


___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-13 Thread Valeri Galtsev




On 2019-05-13 16:55, J Martin Rushton via CentOS wrote:

On 13/05/2019 22:25, Pete Biggs wrote:

On Mon, 2019-05-13 at 16:20 -0400, Bee.Lists wrote:




It may not be "just another user", but it *is* a user as much as your
login username is a user. You could assign your own username a UID of
0, and it would have the same privileges as 'root', but it would still
act as your username.  NOTE: doing this is NOT recommended, do not do
it, seriously, do NOT do it.




P.


___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos



Shame that "security experts" regularly recommend using another name for
the root account - security through obscurity anyone?


Not here, sorry ;-)

Valeri

PS Script kiddies will get UID=0, not username=root, when succeed in 
pretty much anything they use to elevate privileges on attacked machine.





___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos



--

Valeri Galtsev
Sr System Administrator
Department of Astronomy and Astrophysics
Kavli Institute for Cosmological Physics
University of Chicago
Phone: 773-702-4247

___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-13 Thread J Martin Rushton via CentOS
On 13/05/2019 22:25, Pete Biggs wrote:
> On Mon, 2019-05-13 at 16:20 -0400, Bee.Lists wrote:

> 
> It may not be "just another user", but it *is* a user as much as your
> login username is a user. You could assign your own username a UID of
> 0, and it would have the same privileges as 'root', but it would still
> act as your username.  NOTE: doing this is NOT recommended, do not do
> it, seriously, do NOT do it.
> 

> P.
> 
> 
> ___
> CentOS mailing list
> CentOS@centos.org
> https://lists.centos.org/mailman/listinfo/centos
> 

Shame that "security experts" regularly recommend using another name for
the root account - security through obscurity anyone?

-- 
J Martin Rushton MBCS



signature.asc
Description: OpenPGP digital signature
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-13 Thread Valeri Galtsev



On 2019-05-13 16:25, Pete Biggs wrote:

On Mon, 2019-05-13 at 16:20 -0400, Bee.Lists wrote:

On May 13, 2019, at 2:46 PM, Pete Biggs  wrote:


First, the ~ which might not apply to root.


Why do you think that?  '~' is just shell shorthand for user's home
directory.


root quite often isn’t recognized as a proper user.  ~/.bash_profile
isn’t loaded because it’s not a normal login shell when entering
`su`.


If you switch to any other user using 'su', then their .bash_profile
isn't loaded (unless you specify that it's a login shell).


Whole environment of user that invoked su is "inherited" unless it is 
specified on commend line to get login environment of user one does su into.



 'su'
doesn't mean "super user" it means "substitute user" - the default
happens to be user UID 0.


Thanks Pete! This really needs to be repeated, even though whenever su 
is mentioned I repeat that to my users that it means "substitute user", 
but now that you mentioned it here it makes this whole thread clear.


Valeri






Second, it’s a “personal” init file, which also might not pertain to
root.


root is just as much a user as anyone else, albeit one with special
privileges because they are UID 0.


So I can’t assume it’s just another user.


It may not be "just another user", but it *is* a user as much as your
login username is a user. You could assign your own username a UID of
0, and it would have the same privileges as 'root', but it would still
act as your username.  NOTE: doing this is NOT recommended, do not do
it, seriously, do NOT do it.




Going from user to root (su) might not initiate a login shell.  I’m
not clear on this.


Are you logging in? (i.e. typing the username and password at a login
prompt.)  If not, then it's not a login shell.


Isn’t moving from my own user using su, then prompted for password
count as a login?


No. It doesn't. The password prompt is for authentication, not logging
in.



man su doesn’t apply to root with regards to the files loaded up upon
login.


Could you explain what you mean by that.

P.


___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos



--

Valeri Galtsev
Sr System Administrator
Department of Astronomy and Astrophysics
Kavli Institute for Cosmological Physics
University of Chicago
Phone: 773-702-4247

___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-13 Thread Pete Biggs
On Mon, 2019-05-13 at 16:20 -0400, Bee.Lists wrote:
> > On May 13, 2019, at 2:46 PM, Pete Biggs  wrote:
> > 
> > > First, the ~ which might not apply to root. 
> > 
> > Why do you think that?  '~' is just shell shorthand for user's home
> > directory.
> 
> root quite often isn’t recognized as a proper user.  ~/.bash_profile
> isn’t loaded because it’s not a normal login shell when entering
> `su`.  

If you switch to any other user using 'su', then their .bash_profile
isn't loaded (unless you specify that it's a login shell).  'su'
doesn't mean "super user" it means "substitute user" - the default
happens to be user UID 0.

> 
> > > Second, it’s a “personal” init file, which also might not pertain to
> > > root.  
> > 
> > root is just as much a user as anyone else, albeit one with special
> > privileges because they are UID 0.
> 
> So I can’t assume it’s just another user.  

It may not be "just another user", but it *is* a user as much as your
login username is a user. You could assign your own username a UID of
0, and it would have the same privileges as 'root', but it would still
act as your username.  NOTE: doing this is NOT recommended, do not do
it, seriously, do NOT do it.

> 
> > > Going from user to root (su) might not initiate a login shell.  I’m
> > > not clear on this. 
> > 
> > Are you logging in? (i.e. typing the username and password at a login
> > prompt.)  If not, then it's not a login shell.
> 
> Isn’t moving from my own user using su, then prompted for password
> count as a login?  

No. It doesn't. The password prompt is for authentication, not logging
in.

> 
> man su doesn’t apply to root with regards to the files loaded up upon
> login. 

Could you explain what you mean by that.

P.


___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-13 Thread Jonathan Billings
On Mon, May 13, 2019 at 04:20:17PM -0400, Bee.Lists wrote:
> > On May 13, 2019, at 2:46 PM, Pete Biggs  wrote:
> > Why do you think that?  '~' is just shell shorthand for user's home
> > directory.
> 
> root quite often isn’t recognized as a proper user.  ~/.bash_profile
> isn’t loaded because it’s not a normal login shell when entering
> `su`.

You'd find that if there's another user account on your system (lets
call it "fred"), and you ran 'su fred', it would not load
~fred/.bash_profile either, because it wasn't a login shell.  'root'
isn't special here.

> Isn’t moving from my own user using su, then prompted for password
> count as a login?   

As you read in the 'bash' man page, files that are loaded with a
"login shell" are different from files loaded from a normal shell
execution.  'su' has specific syntax for either running a shell as a
user or running a login shell as a user.  Just typing a password at
the prompt doesn't mean it was a login shell.

Typically, a 'login shell' is what you get when you log into a system
through login: or a graphical login.  .bash_profile is loaded once
when you log in.  It's meant for login stuff.  .bashrc is loaded for
every shell you start.

'su' is a tool used to switch users, so you are given the option to
either start a shell as a user or log in as that user, depending on
the situation.  

> man su doesn’t apply to root with regards to the files loaded up
> upon login.  Consequences of reading generic man pages result in
> more than one option.   

The 'su' man page explains all of this pretty well I think.  Becoming
root isn't special, in terms of loading .bash_profile vs. .bashrc.

-- 
Jonathan Billings 
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-13 Thread Bee.Lists

> On May 13, 2019, at 2:46 PM, Pete Biggs  wrote:
> 
>> First, the ~ which might not apply to root. 
> 
> Why do you think that?  '~' is just shell shorthand for user's home
> directory.

root quite often isn’t recognized as a proper user.  ~/.bash_profile isn’t 
loaded because it’s not a normal login shell when entering `su`.  

>> Second, it’s a “personal” init file, which also might not pertain to
>> root.  
> 
> root is just as much a user as anyone else, albeit one with special
> privileges because they are UID 0.

So I can’t assume it’s just another user.  

>> Going from user to root (su) might not initiate a login shell.  I’m
>> not clear on this. 
> 
> Are you logging in? (i.e. typing the username and password at a login
> prompt.)  If not, then it's not a login shell.

Isn’t moving from my own user using su, then prompted for password count as a 
login?  

>> 
>> But, .bash_profile is not loading.
>> 
>> I have my aliases in another file called /root/.bash_aliases, which
>> is a duplicate of my /home/myuser/.bash_aliases which is NOW sourced
>> in my /root/.bashrc so it now works.
>> 
>> So ya, got it to work, but knowing the cascade of inclusions is
>> important.  root is as important to me as my normal user.  
>> 
> 
> Yes. If you are going to be playing around as root, then you really
> should know the consequences of what you are doing.  When I started
> using Unix 30mumble years ago, the perceived wisdom was *always* invoke
> su as /bin/su, those where the days when '.' was frequently in a users
> path and some nasty user might leave scripts called 'su' lying around
> waiting for an admin to occidentally execute them.  Second, invoke it
> as '/bin/su -', that way you clean out any user variables and only have
> the environment you have setup for root.

man su doesn’t apply to root with regards to the files loaded up upon login.  
Consequences of reading generic man pages result in more than one option.  


Cheers, Bee




___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-13 Thread Jonathan Billings
On Mon, May 13, 2019 at 01:39:27PM -0400, Bee.Lists wrote:
> $ man bash (INVOCATION)

You might also benefit from reading the man page for 'su', which will
explain why running 'su -' is different from running 'su'.

-- 
Jonathan Billings 
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-13 Thread Pete Biggs

> ~/.bash_profile
>   The personal initialization file, executed for login shells
> 
> First, the ~ which might not apply to root. 

Why do you think that?  '~' is just shell shorthand for user's home
directory.

>  Second, it’s a “personal” init file, which also might not pertain to
> root.  

root is just as much a user as anyone else, albeit one with special
privileges because they are UID 0.

> Going from user to root (su) might not initiate a login shell.  I’m
> not clear on this. 

Are you logging in? (i.e. typing the username and password at a login
prompt.)  If not, then it's not a login shell.

> 
> But, .bash_profile is not loading.
> 
> I have my aliases in another file called /root/.bash_aliases, which
> is a duplicate of my /home/myuser/.bash_aliases which is NOW sourced
> in my /root/.bashrc so it now works.
> 
> So ya, got it to work, but knowing the cascade of inclusions is
> important.  root is as important to me as my normal user.  
> 

Yes. If you are going to be playing around as root, then you really
should know the consequences of what you are doing.  When I started
using Unix 30mumble years ago, the perceived wisdom was *always* invoke
su as /bin/su, those where the days when '.' was frequently in a users
path and some nasty user might leave scripts called 'su' lying around
waiting for an admin to occidentally execute them.  Second, invoke it
as '/bin/su -', that way you clean out any user variables and only have
the environment you have setup for root.

P.


___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-13 Thread Bee.Lists
OK that’s exactly what I just was questioning.  The documentation wasn’t clear 
on the ‘man bash’ (INVOCATION) notes.  

So I entered my inclusion of my aliases file (it’s my own) inside .bashrc.  

Thank you


> On May 13, 2019, at 1:31 PM, Chris Adams  wrote:
> 
> .bash_profile will not be read when you just run "su", because
> .bash_profile is read in a login shell, and "su" does not create a login
> shell.
> 
> .bashrc will be read (and is really where aliases belong anyway), or you
> can "su -" to create a login shell.



Cheers, Bee




___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-13 Thread Bee.Lists
$ man bash (INVOCATION)

When bash is invoked as an interactive login shell, or as a non-interactive 
shell with the --login option, it first reads and executes commands from the 
file /etc/profile, if that file
   exists.  After reading that file, it looks for ~/.bash_profile, 
~/.bash_login, and ~/.profile, in that order, and reads and executes commands 
from the first  one  that  exists  and  is
   readable.  The --noprofile option may be used when the shell is started 
to inhibit this behavior.

But the reference to .bash_profile has some unclear restrictions or boundaries:

~/.bash_profile
  The personal initialization file, executed for login shells

First, the ~ which might not apply to root.  Second, it’s a “personal” init 
file, which also might not pertain to root.  Going from user to root (su) might 
not initiate a login shell.  I’m not clear on this. 

But, .bash_profile is not loading.

I have my aliases in another file called /root/.bash_aliases, which is a 
duplicate of my /home/myuser/.bash_aliases which is NOW sourced in my 
/root/.bashrc so it now works.

So ya, got it to work, but knowing the cascade of inclusions is important.  
root is as important to me as my normal user.  



> On May 13, 2019, at 1:17 PM, Christian, Mark  wrote:
> 
> $ man bash, search on INVOCATION



Cheers, Bee




___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-13 Thread Chris Adams
Once upon a time, Bee.Lists  said:
> No, this isn’t a case of multi partitions, clusters, or anything silly.  I 
> just want a set of aliases loaded for su.  /root/.bash_profile isn’t loading, 
> and there isn’t any obvious choice as to where the loaded .bash* were loading 
> from.  

.bash_profile will not be read when you just run "su", because
.bash_profile is read in a login shell, and "su" does not create a login
shell.

.bashrc will be read (and is really where aliases belong anyway), or you
can "su -" to create a login shell.
-- 
Chris Adams 
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-13 Thread Bee.Lists
No, this isn’t a case of multi partitions, clusters, or anything silly.  I just 
want a set of aliases loaded for su.  /root/.bash_profile isn’t loading, and 
there isn’t any obvious choice as to where the loaded .bash* were loading from. 
 


> On May 13, 2019, at 9:11 AM, Stephen John Smoogen  wrote:
> 
> While moving /root to /home/root is done in someplaces, it only works if
> /home is not on a different partition. If you put /home on a different
> partition you will find all kinds of weird behavior happening on start up.



Cheers, Bee




___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-13 Thread Bee.Lists
OK, I haven’t tested for that loadup yet, and the .bashrc is indeed there.  I 
thought .bashrc was loaded first, then .bash_profile.  This is for normal user. 
 

Just tested it again, and /root/.bash_profile is not loading.  Tried this in 
/root/.bashrc:

source /root/.bash_profile

That created a loop, because that reverse instruction is inside 
/root/.bash_profile

So for some reason, entering su isn’t loading its own .bash_profile nor keeping 
my user’s .bash_profile (expected).  

Any ideas?


> On May 13, 2019, at 8:49 AM, ja  wrote:
> 
> I have an alias in /root/.bashrc
> alias sbp='source ~/.bash_profile'
> 



Cheers, Bee




___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-13 Thread Christian, Mark
On Mon, 2019-05-13 at 13:06 -0400, Bee.Lists wrote:
> Ah thank you.  Having forgotten this, I already had all my aliases
> and instructions in there.  For some reason they aren’t loading.  If
> I do this, then everything loads:
> 
> source /root/.bash_profile
> 
> So there’s an indication this isn’t loading upon entry into su.  Is
> this normal?  

$ man bash, search on INVOCATION

> 
> 
> > On May 13, 2019, at 8:38 AM, Nux!  wrote:
> > 
> > Hi,
> > 
> > The $home of root is /root, just copy it there.
> 
> 
> Cheers, Bee
> 
> 
> 
> 
> ___
> CentOS mailing list
> CentOS@centos.org
> https://lists.centos.org/mailman/listinfo/centos
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-13 Thread Bee.Lists
Ah thank you.  Having forgotten this, I already had all my aliases and 
instructions in there.  For some reason they aren’t loading.  If I do this, 
then everything loads:

source /root/.bash_profile

So there’s an indication this isn’t loading upon entry into su.  Is this 
normal?  


> On May 13, 2019, at 8:38 AM, Nux!  wrote:
> 
> Hi,
> 
> The $home of root is /root, just copy it there.



Cheers, Bee




___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-13 Thread Valeri Galtsev



On 2019-05-13 07:38, Nux! wrote:

Hi,

The $home of root is /root, just copy it there.


It is $HOME not $home ;-)

Valeri



--
Sent from the Delta quadrant using Borg technology!

Nux!
www.nux.ro

- Original Message -

From: "Bee.Lists" 
To: "CentOS mailing list" 
Sent: Monday, 13 May, 2019 13:28:24
Subject: [CentOS] root .bash_profile?



Hi folks.  Just wondering how I can implement an automatic .bash_profile for
root.  I have to load my user .bash_profile every time I get into root, and I
would like a better solution.  There is no /home/ for root, so I’m a bit
confused if this is even allowed.

Any insight appreciated.


Cheers, Bee




___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos

___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos



--

Valeri Galtsev
Sr System Administrator
Department of Astronomy and Astrophysics
Kavli Institute for Cosmological Physics
University of Chicago
Phone: 773-702-4247

___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-13 Thread Stephen John Smoogen
On Mon, 13 May 2019 at 08:28, Bee.Lists  wrote:

> Hi folks.  Just wondering how I can implement an automatic .bash_profile
> for root.  I have to load my user .bash_profile every time I get into root,
> and I would like a better solution.  There is no /home/ for root, so I’m a
> bit confused if this is even allowed.
>
>
Most Linux distributions since the mid 1990's have made /root the home
directory for their UID 0 user. This was because /home was not guaranteed
to be mounted when the system started up AND people were annoyed with the
Unix tradition of having UID 0 with the / as the home directory. [Having
UID 0 with / caused all kinds of file components to show up in / and
sometimes with the worst permissions.. so any user might source through
/.history and find some password etc.]

While moving /root to /home/root is done in someplaces, it only works if
/home is not on a different partition. If you put /home on a different
partition you will find all kinds of weird behavior happening on start up.



> Any insight appreciated.
>
>
> Cheers, Bee
>
>
>
>
> ___
> CentOS mailing list
> CentOS@centos.org
> https://lists.centos.org/mailman/listinfo/centos
>


-- 
Stephen J Smoogen.
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-13 Thread Peda, Allan (NYC-GIS)
The following one liner should display root's home directory:

grep -w ^root /etc/passwd | cut -d: -f6

Which finds the line beginning with the word root, and returns the sixth entry 
(the home directory of that entry).


On 5/13/19, 8:39 AM, "CentOS on behalf of Nux!"  wrote:

Hi,

The $home of root is /root, just copy it there.

--
Sent from the Delta quadrant using Borg technology!

Nux!

https://urldefense.proofpoint.com/v2/url?u=http-3A__www.nux.ro=DwIGaQ=Ftw_YSVcGmqQBvrGwAZugGylNRkk-uER0-5bY94tjsc=Tou2GfskafF_UnC0yPjAjEzLDhbALx-0EDoLp3_iSss=BtGUZ97pcKOFG7bhNzhabJQysuxxWgjVQIWf3J07Wj8=ugp8dpIHA9dciXeJwCp2QajbDnF239ydtrHUdQtebNU=

- Original Message -
> From: "Bee.Lists" 
> To: "CentOS mailing list" 
> Sent: Monday, 13 May, 2019 13:28:24
> Subject: [CentOS] root .bash_profile?

> Hi folks.  Just wondering how I can implement an automatic .bash_profile 
for
> root.  I have to load my user .bash_profile every time I get into root, 
and I
> would like a better solution.  There is no /home/ for root, so I’m a bit
> confused if this is even allowed.
> 
> Any insight appreciated.
> 
> 
> Cheers, Bee
> 
> 
> 
> 
> ___
> CentOS mailing list
> CentOS@centos.org
> 
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.centos.org_mailman_listinfo_centos=DwIGaQ=Ftw_YSVcGmqQBvrGwAZugGylNRkk-uER0-5bY94tjsc=Tou2GfskafF_UnC0yPjAjEzLDhbALx-0EDoLp3_iSss=BtGUZ97pcKOFG7bhNzhabJQysuxxWgjVQIWf3J07Wj8=B82ZL5g_jIXQH525NCuZ0IsQGQiu9LlNIVHR8yg_0-g=
___
CentOS mailing list
CentOS@centos.org

https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.centos.org_mailman_listinfo_centos=DwIGaQ=Ftw_YSVcGmqQBvrGwAZugGylNRkk-uER0-5bY94tjsc=Tou2GfskafF_UnC0yPjAjEzLDhbALx-0EDoLp3_iSss=BtGUZ97pcKOFG7bhNzhabJQysuxxWgjVQIWf3J07Wj8=B82ZL5g_jIXQH525NCuZ0IsQGQiu9LlNIVHR8yg_0-g=



This message contains information which may be confidential and privileged. 
Unless you are the intended recipient (or authorized to receive this message 
for the intended recipient), you may not use, copy, disseminate or disclose to 
anyone the message or any information contained in the message.  If you have 
received the message in error, please advise the sender by reply e-mail, and 
delete the message.  Thank you very much.
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-13 Thread ja
On Mon, 2019-05-13 at 08:28 -0400, Bee.Lists wrote:
> Hi folks.  Just wondering how I can implement an automatic .bash_profile for 
> root.  I have to load my
> user .bash_profile every time I get into root, and I would like a better 
> solution.  There is no /home/
> for root, so I’m a bit confused if this is even allowed.
> 
> Any insight appreciated.
> 
> 
> Cheers, Bee
> 
For a "normal" installation root's home directory is /root
From a users account the "-" will source /root/.bash_profile
and change to root's home directory.
ja@naxos ~ 1$ su -
Password: 
[root@naxos:~]$ pwd
/root
[root@naxos:~]$

For the occasions when it is desirable NOT to cd /root

I have an alias in /root/.bashrc
alias sbp='source ~/.bash_profile'

ja@naxos ~ 2$ pwd
/home/ja
ja@naxos ~ 3$ su
Password: 
root@naxos ja 1001$ pwd
/home/ja
root@naxos ja 1002$ sbp
[root@naxos:/home/ja]$ pwd
/home/ja

/root/.bash_profile
changes the colour of the prompt (among other things)
PS1="\[\033[1;31m\][\u@\h:\w]$\[\033[0m\] "


There must be much better ways of doing this!


___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] root .bash_profile?

2019-05-13 Thread Nux!
Hi,

The $home of root is /root, just copy it there.

--
Sent from the Delta quadrant using Borg technology!

Nux!
www.nux.ro

- Original Message -
> From: "Bee.Lists" 
> To: "CentOS mailing list" 
> Sent: Monday, 13 May, 2019 13:28:24
> Subject: [CentOS] root .bash_profile?

> Hi folks.  Just wondering how I can implement an automatic .bash_profile for
> root.  I have to load my user .bash_profile every time I get into root, and I
> would like a better solution.  There is no /home/ for root, so I’m a bit
> confused if this is even allowed.
> 
> Any insight appreciated.
> 
> 
> Cheers, Bee
> 
> 
> 
> 
> ___
> CentOS mailing list
> CentOS@centos.org
> https://lists.centos.org/mailman/listinfo/centos
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos