LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 02-04-2008, 06:35 PM   #1
noir911
Member
 
Registered: Apr 2004
Posts: 682

Rep: Reputation: Disabled
[solaris 9] export environment settings via ssh


Every time I ssh to this Solaris 9 box I need to type

bash
export EDITOR=vi
export TERM=xterm
stty columns 132

I know I can automate the whole thing but I would rather not as this is my my own box

I was wondering if I could export my local "linux" machine's env(ironment) to the remote (Solaris 9) box only for the current session so that I don't have to type these anymore.

Thanks for any help.
 
Old 02-04-2008, 08:31 PM   #2
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197

Rep: Reputation: 105Reputation: 105
Why just do it for the current session? If the Solaris box is yours, change your shell in /etc/passwd to bash. Then edit your .profile in your home directory and add the settings you want.
 
Old 02-04-2008, 10:36 PM   #3
noir911
Member
 
Registered: Apr 2004
Posts: 682

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by choogendyk View Post
Why just do it for the current session? If the Solaris box is yours, change your shell in /etc/passwd to bash. Then edit your .profile in your home directory and add the settings you want.
That's what I said in my original post, the Solaris box is not mine & I cannot change the .profile in the login ID I have.
 
Old 02-04-2008, 11:01 PM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
You can create a small launcher script file containing the appropriate commands on the remote machine and run this launcher from your ssh client.
 
Old 02-05-2008, 07:13 AM   #5
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197

Rep: Reputation: 105Reputation: 105
Quote:
Originally Posted by noir911 View Post
That's what I said in my original post, the Solaris box is not mine & I cannot change the .profile in the login ID I have.
??? I thought it was a little confusing when you originally posted it. What it said was, "as this is my own box":

Quote:
Originally Posted by noir911 View Post
I know I can automate the whole thing but I would rather not as this is my my own box

OK. So, the box is *not* yours. Is the login yours? Or are you doing the classically insecure sharing of a login with others? Or is this the root login that you are ssh'ing to?

I don't allow remote connections to root on my Solaris boxes. Everyone has to have their own unique login. Then they use su if they are an admin, or sudo if they are a semi-privileged user, in order to do things that require root privileges.

So, if it is your login, you can still edit your .profile.

If it is a shared login, you can create another script as suggested by jlliagre.

Note that the behavior of the script may initially seem counter intuitive. When it invokes bash, it starts a subprocess and you are in that until you exit. Your setting of environment variables will not happen until after you exit bash (using the sequence you originally posted). Then they will disappear when you exit the script (if you invoke it with "./script").

So, what you want is to put the setting of the environment variables before you invoke bash and export them so that they go to the bash subprocess. If you wanted them to be set in your current process, then you could invoke the script with ". ./script" (that is "dot space dot slash"), which executes the script within your current process rather than starting a subprocess.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to export environment variable from a bash script dimaash Linux - Newbie 20 08-09-2011 07:12 AM
export password to environment in terminal blckspder Linux - Server 3 12-13-2007 07:17 PM
export - Invalid identifier for environment variable ryan.greenwood Linux - Desktop 2 05-27-2007 10:22 PM
How to export special characters into environment variables? das_Schaf Linux - General 6 06-24-2006 07:17 AM
really easy question: why won't my environment variables export digitized_funk Linux - Newbie 3 10-22-2003 05:22 AM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 12:27 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