Skip to main content
Removed typo ~./.bash_profile
Source Link
Marchy
  • 43
  • 1
  • 1
  • 5

The situation:

I run Ubuntu 12.04 LTS on a virtual machine.

I regularly have to connect to my account on a university server, I do this by opening up terminal and using ssh -Y [email protected].

Once there I always have to run the following

setenv PYTHONPATH "place/stuff/this_goes_on_forever"

And also a few other lines of code.

What I want:

  1. My main request: I would like to prepare a script and have that run automatically whenever I log in to the server via ssh.

  2. This is a side query, but when I use alias p="pwd" (for example) the new aliases do not 'take', typing p in this case results in 'command not found'. Is this just a consequence of not being root, or because I am logged in via ssh, or is there a fix for this perhaps?

Attempts at a solution:

I tried adding export PYTHONPATH="..." to my local ~/.bashrc file which means when I start terminal PYTHONPATH is set, however after I ssh to the server it is no longer set (well I have a whole new host of environment variables). I tried ~./.bash_profile after, didn't work.

I have tried adding export PYTHONPATH="..." to the ~/.bash_profile file on the server, and also to the ~/.bashrc file- but neither worked.

I do not have root access on the server so cannot change AcceptEnv or PermitUserEnvironement within the sshd_config file on the server, it is just read-only.

Surely there is somewhere I can put this code, I just can't find where.

The situation:

I run Ubuntu 12.04 LTS on a virtual machine.

I regularly have to connect to my account on a university server, I do this by opening up terminal and using ssh -Y [email protected].

Once there I always have to run the following

setenv PYTHONPATH "place/stuff/this_goes_on_forever"

And also a few other lines of code.

What I want:

  1. My main request: I would like to prepare a script and have that run automatically whenever I log in to the server via ssh.

  2. This is a side query, but when I use alias p="pwd" (for example) the new aliases do not 'take', typing p in this case results in 'command not found'. Is this just a consequence of not being root, or because I am logged in via ssh, or is there a fix for this perhaps?

Attempts at a solution:

I tried adding export PYTHONPATH="..." to my local ~/.bashrc file which means when I start terminal PYTHONPATH is set, however after I ssh to the server it is no longer set (well I have a whole new host of environment variables). I tried ~./.bash_profile after, didn't work.

I have tried adding export PYTHONPATH="..." to the ~/.bash_profile file on the server, and also to the ~/.bashrc file- but neither worked.

I do not have root access on the server so cannot change AcceptEnv or PermitUserEnvironement within the sshd_config file on the server, it is just read-only.

Surely there is somewhere I can put this code, I just can't find where.

The situation:

I run Ubuntu 12.04 LTS on a virtual machine.

I regularly have to connect to my account on a university server, I do this by opening up terminal and using ssh -Y [email protected].

Once there I always have to run the following

setenv PYTHONPATH "place/stuff/this_goes_on_forever"

And also a few other lines of code.

What I want:

  1. My main request: I would like to prepare a script and have that run automatically whenever I log in to the server via ssh.

  2. This is a side query, but when I use alias p="pwd" (for example) the new aliases do not 'take', typing p in this case results in 'command not found'. Is this just a consequence of not being root, or because I am logged in via ssh, or is there a fix for this perhaps?

Attempts at a solution:

I tried adding export PYTHONPATH="..." to my local ~/.bashrc file which means when I start terminal PYTHONPATH is set, however after I ssh to the server it is no longer set (well I have a whole new host of environment variables). I tried ~/.bash_profile after, didn't work.

I have tried adding export PYTHONPATH="..." to the ~/.bash_profile file on the server, and also to the ~/.bashrc file- but neither worked.

I do not have root access on the server so cannot change AcceptEnv or PermitUserEnvironement within the sshd_config file on the server, it is just read-only.

Surely there is somewhere I can put this code, I just can't find where.

Show appreciation through votes on answers. Thanks and username (profile!) not necessary on SO/SX http://meta.stackoverflow.com/a/3021/186664
Source Link
Anthon
  • 81.4k
  • 42
  • 174
  • 228

The situation:

I run Ubuntu 12.04 LTS on a virtual machine.

I regularly have to connect to my account on a university server, I do this by opening up terminal and using ssh -Y [email protected].

Once there I always have to run the following

setenv PYTHONPATH "place/stuff/this_goes_on_forever"

And also a few other lines of code.

What I want:

1.)My main request: I would like to prepare a script and have that run automatically whenever I log in to the server via ssh.

2.)This is a side query, but when I use alias p="pwd" (for example) the new aliases do not 'take', typing p in this case results in 'command not found'. Is this just a consequence of not being root, or because I am logged in via ssh, or is there a fix for this perhaps?

  1. My main request: I would like to prepare a script and have that run automatically whenever I log in to the server via ssh.

  2. This is a side query, but when I use alias p="pwd" (for example) the new aliases do not 'take', typing p in this case results in 'command not found'. Is this just a consequence of not being root, or because I am logged in via ssh, or is there a fix for this perhaps?

Attempts at a solution:

I tried adding export PYTHONPATH="..." to my local ~/.bashrc file which means when I start terminal PYTHONPATH is set, however after I ssh to the server it is no longer set (well I have a whole new host of environment variables). I tried ~./.bash_profile after, didn't work.

I have tried adding export PYTHONPATH="..." to the ~/.bash_profile file on the server, and also to the ~/.bashrc file- but neither worked.

I do not have root access on the server so cannot change AcceptEnv or PermitUserEnvironement within the sshd_config file on the server, it is just read-only.

Surely there is somewhere I can put this code, I just can't find where. Thanks for taking the time to read this, Ben.

The situation:

I run Ubuntu 12.04 LTS on a virtual machine.

I regularly have to connect to my account on a university server, I do this by opening up terminal and using ssh -Y [email protected].

Once there I always have to run the following

setenv PYTHONPATH "place/stuff/this_goes_on_forever"

And also a few other lines of code.

What I want:

1.)My main request: I would like to prepare a script and have that run automatically whenever I log in to the server via ssh.

2.)This is a side query, but when I use alias p="pwd" (for example) the new aliases do not 'take', typing p in this case results in 'command not found'. Is this just a consequence of not being root, or because I am logged in via ssh, or is there a fix for this perhaps?

Attempts at a solution:

I tried adding export PYTHONPATH="..." to my local ~/.bashrc file which means when I start terminal PYTHONPATH is set, however after I ssh to the server it is no longer set (well I have a whole new host of environment variables). I tried ~./.bash_profile after, didn't work.

I have tried adding export PYTHONPATH="..." to the ~/.bash_profile file on the server, and also to the ~/.bashrc file- but neither worked.

I do not have root access on the server so cannot change AcceptEnv or PermitUserEnvironement within the sshd_config file on the server, it is just read-only.

Surely there is somewhere I can put this code, I just can't find where. Thanks for taking the time to read this, Ben.

The situation:

I run Ubuntu 12.04 LTS on a virtual machine.

I regularly have to connect to my account on a university server, I do this by opening up terminal and using ssh -Y [email protected].

Once there I always have to run the following

setenv PYTHONPATH "place/stuff/this_goes_on_forever"

And also a few other lines of code.

What I want:

  1. My main request: I would like to prepare a script and have that run automatically whenever I log in to the server via ssh.

  2. This is a side query, but when I use alias p="pwd" (for example) the new aliases do not 'take', typing p in this case results in 'command not found'. Is this just a consequence of not being root, or because I am logged in via ssh, or is there a fix for this perhaps?

Attempts at a solution:

I tried adding export PYTHONPATH="..." to my local ~/.bashrc file which means when I start terminal PYTHONPATH is set, however after I ssh to the server it is no longer set (well I have a whole new host of environment variables). I tried ~./.bash_profile after, didn't work.

I have tried adding export PYTHONPATH="..." to the ~/.bash_profile file on the server, and also to the ~/.bashrc file- but neither worked.

I do not have root access on the server so cannot change AcceptEnv or PermitUserEnvironement within the sshd_config file on the server, it is just read-only.

Surely there is somewhere I can put this code, I just can't find where.

Source Link
Marchy
  • 43
  • 1
  • 1
  • 5

Set environment variable automatically upon SSH login (no root access)

The situation:

I run Ubuntu 12.04 LTS on a virtual machine.

I regularly have to connect to my account on a university server, I do this by opening up terminal and using ssh -Y [email protected].

Once there I always have to run the following

setenv PYTHONPATH "place/stuff/this_goes_on_forever"

And also a few other lines of code.

What I want:

1.)My main request: I would like to prepare a script and have that run automatically whenever I log in to the server via ssh.

2.)This is a side query, but when I use alias p="pwd" (for example) the new aliases do not 'take', typing p in this case results in 'command not found'. Is this just a consequence of not being root, or because I am logged in via ssh, or is there a fix for this perhaps?

Attempts at a solution:

I tried adding export PYTHONPATH="..." to my local ~/.bashrc file which means when I start terminal PYTHONPATH is set, however after I ssh to the server it is no longer set (well I have a whole new host of environment variables). I tried ~./.bash_profile after, didn't work.

I have tried adding export PYTHONPATH="..." to the ~/.bash_profile file on the server, and also to the ~/.bashrc file- but neither worked.

I do not have root access on the server so cannot change AcceptEnv or PermitUserEnvironement within the sshd_config file on the server, it is just read-only.

Surely there is somewhere I can put this code, I just can't find where. Thanks for taking the time to read this, Ben.