forked from danrabinowitz/sshrc
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsshrc.1
152 lines (135 loc) · 3.2 KB
/
sshrc.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
.TH man 1 "22 October 2016" "1.0" "sshrc man page"
.SH NAME
sshrc \- carry your dotfiles with you
.SH SYNOPSIS
.B sshrc
.nh
[\fIOPTIONS\fR]
[\fISSH_ARGS\fR...]
.SH OPTIONS
.TP
.BI "\-\-archiver=" UTILITY
Use
.I UTILITY
for compression. Default is
.IR bzip2 ;
.I gzip
and
.I xz
are also supported.
.TP
.BI "\-\-arg\-max=" BYTES
Ensure
.B SSHRC_CMD
is less than
.I BYTES
in size. Default is 65536 (64kb). Set to 0 to disable this check.
.TP
.B \-\-arg\-size
Print the compressed size of
.B SSHRC_CMD
in bytes and exit.
.TP
.B \-\-hushlogin
Suppress motd welcome messages. This can also be accomplished by creating a
.I .hushlogin
file in
.IR $SSHHOME/.sshrc.d .
.TP
.B \-\-no-bin
Don't copy this sshrc script to the remote host. This may speed up initial ssh connections slightly. It can also be used to reduce the size of the
.BR SSHRC_CMD .
.TP
.B \-\-debug\fR[\fI=LEVEL\fR]
Print out debug info.
.I LEVEL
1 prints the
.BR SSHRC_CMD .
.I LEVEL
2 prints the uncompressed bootstrap script.
.TP
.B \-h, \-\-help
Display a help message and exit.
.SH SSHRC_CMD
This is the remote command that sshrc passes to ssh. It is comprised of the compressed sshrc bootstrap script and the commands needed to decompress and run it. The .sshrc config file and files within .sshrc.d are embedded within the bootstrap script.
.P
If a remote command is passed to sshrc, it will be incorporated into the
.B SSHRC_CMD
and run after starting the shell.
.P
Some shells (both locally and on the remote server) will complain if this command is too large. For this reason, sshrc will refuse to run if the command exceeds 64kb. The threshold for this check can be modified or disabled with
.BR \-\-arg-max .
.SH CONFIGURATION
.TP
.I $SSHHOME
Locally, this location is a place to put all of your
.B sshrc
configuration files. If not set
.B sshrc
will check for config files in the current directory or
.IR $HOME .
On the remote server,
.B sshrc
creates a temporary
.I $SSHHOME
directory and copies its configuration files there.
.TP
.I $SSHHOME/.sshrc
.B sshrc
sources this file after logging in to a remote server. Use it to change the prompt, export variables, or define functions and aliases.
.TP
.I $SSHHOME/.sshrc.d
.B sshrc
will copy anything in this directory to the remote server. You can then tell programs to load their configuration from the
.I $SSHHOME/.sshrc.d
directory by setting the right environment variables.
.TP
.B ALTERNATE SHELL
.B sshrc
uses
.B bash
by default. To use an alternate shell, create a
.I $SSHHOME/.sshrc.d/sh
file that wraps the desired shell. See
.B EXAMPLES
for an example with
.BR zsh .
.SH EXAMPLES
.B $ sshrc \-\-hushlogin user@host
Log into remote server
.B host
as the user
.B user
and suppress any welcome message.
.B $ cat <<'EOF' > $SSHHOME/.sshrc.d/sh
.br
.B #/usr/bin/env zsh
.br
.B echo '
.br
.B for file in .zshenv .zprofile .zlogin; do
.br
.RS 2
.B [[ -r $HOME/$file ]] && cp {$HOME,$SSHHOME}/$file
.br
.RE
.B done
.br
.B export PATH=$PATH:\\\\$SSHHOME
.br
.B source $SSHHOME/.sshrc
.br
.B ' > $SSHHOME/.zshrc
.br
.B ZDOTDIR=$SSHHOME exec zsh "$@"
.br
.B EOF
Create a wrapper script around
.BR zsh .
.B sshrc
will use this to start
.B zsh
as the remote shell.
.SH SEE ALSO
\fBssh\fP(1) contains more information about
.IR SSH_ARGS .