Web lists-archives.com

Re: Start Vim at logout / login




-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, Apr 25, 2018 at 12:59:07PM +0200, basti wrote:
> I try todo somethink like:
> 
> /etc/pam.d/sshd
> # Run perl script at logout/ login
> session     optional    pam_exec.so quiet /usr/local/bin/wrapper_script
> 
> /usr/local/bin/wrapper_script
> #!/bin/sh
> if [ "$PAM_TYPE" = "open_session" ]; then
> 	some_perl_script
> fi
> 
> some_perl_script is start vim like
> 
> my $EDITOR   = $ENV{VISUAL} || $ENV{EDITOR} || "vim";
> system($EDITOR, "+5", $file)

Ah, you want to ssh into some box and be greeted there
by a freshly started vim...

PAM seems to be the wrong instrument. I don't know if
it even knows whether your session is running.

One possibility would be to invoke it client-side, like
so:

  ssh -t me@xxxxxxxxx vim

(the -t is there to coax ssh into allocating a PTY, because
the other side will be a screen-based program).

Another would be to embed a command in the other side's
authorized_keys entry (the nice thing about this solution
is that you can control that on a key-by-key basis).

Cheers
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlrgYlEACgkQBcgs9XrR2kaA8wCfZQqp73ZpWxfHPF9NrWb98G38
nmIAnRdzQMoyF5BL2YDyDNc2TP+TfEuj
=5pWj
-----END PGP SIGNATURE-----