personal ssh config

53 views
Skip to first unread message

jpta

unread,
Apr 22, 2009, 3:18:56 PM4/22/09
to slack users
Hello.

Searching in the archive, I've seen a mention about a role accompanied
by ~/.ssh/config file and keys etc.
However I'm not quite sure how to exactly specify such a role:

Should I move the files to the /home/$USER dir and chown and chmod
them using a fixfiles script?
but how do I obtain the $USER (also for chown)?

I know that my intentions are conflicting with the last paragraph of
the slack-intro file stating that Alice and Bob should get same
results, though.

best
Jan

Dan States

unread,
Apr 22, 2009, 8:27:04 PM4/22/09
to slack users
Hey Jan,

in your role's files directory you would install the config and
authorized_keys as such:

rolename/files/home/$USER/.ssh/config
rolename/files/home/$USER/.ssh/authorized_keys

the $USER macro above implies that you actually created a directory
for each user in your role's files directory. To grab the user names
based on directories in home/, you can just iterate through them all
clipping off the home/ with bash substrings.

then in fixfiles (which operates on the STAGE directory, NOT the root
file system) you fix the permissions and ownership (note the relative
paths):

for user_dir in home/*; do
user_name=${user_dir:5}
chmod 700 ${user_dir}/.ssh
chmod 600 ${user_dir}/.ssh/authorized_keys
chown -R ${user_name} ${user_dir}/.ssh
done

you may also want to check to make sure the user exists on the target
system, and print a warning if they don't.

-Dan

Alan Sundell

unread,
Apr 22, 2009, 11:30:04 PM4/22/09
to slack...@googlegroups.com
On Wed, Apr 22, 2009 at 12:18 PM, jpta <jan.p...@gmail.com> wrote:
>
> Hello.
>
> Searching in the archive, I've seen a mention about a role accompanied
> by ~/.ssh/config file and keys etc.
> However I'm not quite sure how to exactly specify such a role:

I'm only aware of people using this to install ssh config in root's
homedir. I don't know of anyone using slack to mess around in users'
homedirs as root, and I'm not sure it's the best tool for that (e.g.
you could use /etc/skel, etc).

> Should I move the files to the /home/$USER dir and chown and chmod
> them using a fixfiles script?
> but how do I obtain the $USER (also for chown)?
>
> I know that my intentions are conflicting with the last paragraph of
> the slack-intro file stating that Alice and Bob should get same
> results, though.

This statement makes me think you intend users to use slack to install
the files in their own homedir, in which case you could just use
--root to change the install root. But I guess then the chown would
not be an issue, since users can't chown stuff.

Maybe you can give more context about what you are trying to do.

--Alan

>
> best
> Jan
> >
>

jpta

unread,
May 12, 2009, 3:22:42 AM5/12/09
to slack users
Thank you all for your replies!

indeed, I'm really trying to (ab)use slack for a different goal that
it was conceived for.
I've got accounts at various linux machines, sometimes I can log as
the root, but sometimes not.
I was trying to make my home environment persistent across machines
and easily installable on any fresh one.

the --root option worked suggested by Alan has worked for me.

thanks again,
best
Jan

On Apr 23, 5:30 am, Alan Sundell <sund...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages