LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-11-2014, 05:45 PM   #1
jamesdunn72
LQ Newbie
 
Registered: Jul 2014
Posts: 6

Rep: Reputation: Disabled
Question Scripts in profile.d automatically executing


I've been facing this weird problem for the last two days.

Here's the scenario
server_a, server_b, server_c
server_b and server_c have hi.sh (echo 'Hi') in /etc/profile.d/, so everytime I login to these systems I get a 'Hi' message.

I've setup password less ssh on these servers.

Now on server_a if I run the following command

server_a # ssh -o "StrictHostKeyChecking no" -o "PasswordAuthentication no" server_b "hostname"
server_b

I get 'server_b' back, which is expected

however

server_a # ssh -o "StrictHostKeyChecking no" -o "PasswordAuthentication no" server_c "hostname"
Hi
server_c

I get Hi and server_c back. This started happening over the last two days, no scripts were changed and am clueless as to why Hi is being returned.

Thanks in advance for your help
 
Old 07-11-2014, 07:02 PM   #2
joe_2000
Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Arch, Debian
Posts: 849

Rep: Reputation: 245Reputation: 245Reputation: 245
Quote:
Originally Posted by jamesdunn72 View Post
I've been facing this weird problem for the last two days.

Here's the scenario
server_a, server_b, server_c
server_b and server_c have hi.sh (echo 'Hi') in /etc/profile.d/, so everytime I login to these systems I get a 'Hi' message.

I've setup password less ssh on these servers.

Now on server_a if I run the following command

server_a # ssh -o "StrictHostKeyChecking no" -o "PasswordAuthentication no" server_b "hostname"
server_b

I get 'server_b' back, which is expected

however

server_a # ssh -o "StrictHostKeyChecking no" -o "PasswordAuthentication no" server_c "hostname"
Hi
server_c

I get Hi and server_c back. This started happening over the last two days, no scripts were changed and am clueless as to why Hi is being returned.

Thanks in advance for your help
Scripts in /etc/profile.d are executed when the file /etc/profile is being sourced. This in turn only happens in login shells. So indeed you should not see "Hi" when only sending a command through ssh. Could it be that you added a source for /etc/profile to your .bashrc on server_c ?
 
Old 07-16-2014, 04:30 PM   #3
jamesdunn72
LQ Newbie
 
Registered: Jul 2014
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by joe_2000 View Post
Scripts in /etc/profile.d are executed when the file /etc/profile is being sourced. This in turn only happens in login shells. So indeed you should not see "Hi" when only sending a command through ssh. Could it be that you added a source for /etc/profile to your .bashrc on server_c ?


I'm not sure what happened, but the problem fixed itself. Thank you for your response.
 
Old 07-16-2014, 04:33 PM   #4
joe_2000
Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Arch, Debian
Posts: 849

Rep: Reputation: 245Reputation: 245Reputation: 245
Quote:
Originally Posted by jamesdunn72 View Post
I'm not sure what happened, but the problem fixed itself. Thank you for your response.
Those are the best problems. Please mark the thread as solved...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems executing scripts Lindy70 Linux - Newbie 2 05-07-2012 01:16 PM
problem executing scripts mierdatuti Linux - General 4 09-19-2008 05:21 AM
Executing scripts jonette20 Linux - General 3 10-15-2007 02:50 PM
executing Bash Scripts c4nk Linux - General 3 03-11-2007 05:52 PM
CGI Scripts not executing Mr_Oz Linux - Enterprise 7 04-18-2006 04:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:41 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration