[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Connect to the ssh and execute any command
From: |
Andrey Tykhonov |
Subject: |
Re: Connect to the ssh and execute any command |
Date: |
Wed, 18 Sep 2013 17:13:14 +0300 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Wed, Sep 18, 2013 at 03:04:10PM +0200, Michael Albinus wrote:
> yary <address@hidden> writes:
>
> > I'm not sure if perl is on Andrey's remote host, but I recall that
> > other parts of Tramp uses it. So here are perl-based alternates to
> > "id":
> >
> > # id -u
> > perl -le 'print$>'
> >
> > # id -un
> > perl -le 'print scalar getpwuid($>)'
> >
> > # id -g
> > perl -le 'print($)=~/(\d+)/)'
> >
> > # id -gn
> > perl -le 'print scalar getgrgid($))'
>
> Looks good, thanks! Andrey, do you have Perl there?
I haven't perl, but there is python.
So, python-based alternates to "id" could looks like:
# id -u
python -c 'import os; print os.getuid()'
# id -un
python -c 'import os; print os.getlogin()'
# id -g
python -c 'import os; print os.getgid()'
# id -gn
python -c 'import os, grp; print grp.getgrgid(os.getgid())[0]'
Best regards, Andrey.
>
> > -y
>
> Best regards, Michael.
- Re: Connect to the ssh and execute any command, Michael Albinus, 2013/09/13
- Re: Connect to the ssh and execute any command, Andrey Tykhonov, 2013/09/17
- Re: Connect to the ssh and execute any command, Michael Albinus, 2013/09/17
- Re: Connect to the ssh and execute any command, Andrey Tykhonov, 2013/09/17
- Re: Connect to the ssh and execute any command, Michael Albinus, 2013/09/18
- Message not available
- Re: Connect to the ssh and execute any command, Michael Albinus, 2013/09/18
- Re: Connect to the ssh and execute any command, yary, 2013/09/18
- Re: Connect to the ssh and execute any command, Michael Albinus, 2013/09/18
- Re: Connect to the ssh and execute any command,
Andrey Tykhonov <=
- Re: Connect to the ssh and execute any command, Michael Albinus, 2013/09/18
- Re: Connect to the ssh and execute any command, Andrey Tykhonov, 2013/09/18
- Re: Connect to the ssh and execute any command, Michael Albinus, 2013/09/19
- Re: Connect to the ssh and execute any command, Andrey Tykhonov, 2013/09/18