Re: bashrc and .profile for password-less ssh



On Thu, Sep 02, 2010 at 10:41:55AM -0500, shantanu pavgi wrote:
I am having some issue in executing in setting values in .bashrc file on ssh
based command execution. If I log in using SSH then bashrc is sourced and
settings in it work. But following doesn't work and returns no value:
{{{
inode:~ shantanu$ ssh 192.168.174.129 "echo $CATALINA_HOME"
}}}

Interactive shells are different:

* they don't read .profile
* they read .bashrc, but your bashrc returns early:

****** And here is .bashrc file:

{{{
shantanu@ubox:~$ cat .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

There.

Move your variable definition above that line and it will be used both
for interactive and non-interactive shell sessions.

Marius Gedminas
--
Cool. Does it also recode ISO10646-1 pcf files into the funny
permutations and subsets used a long time ago in a galaxy far far away
on the planets Isolatinus XV and Koiruski VIII ...
-- Markus Kuhn inquires about libXft

Attachment: signature.asc
Description: Digital signature

--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users


Relevant Pages

  • Re: tomcat startup script not working at boot
    ... Yes I was able to use things without init script. ... What .bashrc is this in? ... which belongs to root's login ... You should read the man pages on the shells carefully do determine ...
    (Ubuntu)
  • Re: [OT] How to add fortune output to terminal
    ... .bashrc from .bash_profile. ... The PS1 is set by default for interactive shells and not set for ... non-interactive shells. ... So the test for $PS1 works without needing to ...
    (Debian-User)
  • Re: umask
    ... user settings vor the bash. ... I change the .bashrc file. ... There's also any settings in the /etc/ bash-related files. ...
    (Debian-User)
  • Re: umask
    ... I can't belive it is so hard to set spezial user settings vor the bash. ... i want to change the default umask permanently for one user. ... I change the .bashrc file. ...
    (Debian-User)
  • Re: .bashrc not executed
    ... >>> On all my accounts, I have bash as my shell. ... > Okay, a local Unix guru assured me that .bashrc should be read, ... > Between login and non-login shells, ...
    (comp.security.ssh)