summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-03-12 19:00:54 +0100
committerLudovic Courtès <ludo@gnu.org>2015-03-12 19:00:54 +0100
commit9a10acc9860d649f4b17c7d84ea685a98ba54b3f (patch)
tree08b774523cd928c7602e73918548f7eaca114005 /gnu
parent99e64a6e7742b8c3727968e5d094e71d33c5cb3f (diff)
downloadguix-9a10acc9860d649f4b17c7d84ea685a98ba54b3f.tar.gz
system: Adjust '.bashrc' skeleton for non-interactive SSH sessions.
* gnu/system/shadow.scm (default-skeletons)[bashrc]: Source /etc/profile
  when in a non-interactive SSH session.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/system/shadow.scm12
1 files changed, 12 insertions, 0 deletions
diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm
index 4a9580a672..4cb8018827 100644
--- a/gnu/system/shadow.scm
+++ b/gnu/system/shadow.scm
@@ -120,6 +120,18 @@
 # Honor per-interactive-shell startup file
 if [ -f ~/.bashrc ]; then . ~/.bashrc; fi\n"))
                       (bashrc (text-file "bashrc" "\
+# Bash initialization for interactive non-login shells and
+# for remote shells (info \"(bash) Bash Startup Files\").
+
+if [ -n \"$SSH_CLIENT\" -a -z \"`type -P cat`\" ]
+then
+    # We are being invoked from a non-interactive SSH session
+    # (as in \"ssh host command\") but 'cat' cannot be found
+    # in $PATH.  Source /etc/profile so we get $PATH and other
+    # essential variables.
+    source /etc/profile
+fi
+
 PS1='\\u@\\h \\w\\$ '
 alias ls='ls -p --color'
 alias ll='ls -l'\n"))