Re: Connect to the ssh and execute any command

2013-09-18 Thread Andrey Tykhonov
On Wed, Sep 18, 2013 at 04:24:21PM +0200, Michael Albinus wrote:
> Andrey Tykhonov  writes:
> 
> > I haven't perl, but there is python.
> >
> > So, python-based alternates to "id" could looks like:
> 
> Well, looks also good. I will add both alternatives (perl-based and
> python-based) to Tramp. When finished, I'll ask you for test :-)

Looking forward for these changes!

Thank you, Michael! :-)

> 
> > Best regards, Andrey.
> 
> Best regards, Michael.

___
Tramp-devel mailing list
Tramp-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/tramp-devel


Re: Connect to the ssh and execute any command

2013-09-18 Thread Michael Albinus
Andrey Tykhonov  writes:

> I haven't perl, but there is python.
>
> So, python-based alternates to "id" could looks like:

Well, looks also good. I will add both alternatives (perl-based and
python-based) to Tramp. When finished, I'll ask you for test :-)

> Best regards, Andrey.

Best regards, Michael.

___
Tramp-devel mailing list
Tramp-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/tramp-devel


Re: Connect to the ssh and execute any command

2013-09-18 Thread Andrey Tykhonov
On Wed, Sep 18, 2013 at 03:04:10PM +0200, Michael Albinus wrote:
> yary  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.

___
Tramp-devel mailing list
Tramp-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/tramp-devel


Re: Connect to the ssh and execute any command

2013-09-18 Thread Andrey Tykhonov
On Wed, Sep 18, 2013 at 12:09:55PM +0200, Michael Albinus wrote:
> Andrey Tykhonov  writes:
> 
> > Hi Michael!
> 
> Hi Andrey,
> 
> > This is not surprise for me as such hosts are very custom. They are not
> > sterling FreeBSD. I'm not sure if I can install something there. But
> > even I can then I'll be needed to install these things again, again and
> > again, because such hosts has very short life, they reinstalls very
> > often, from the scratch, from template which I'm not able to change...
> 
> I see. However, Tramp is not fixed to use `id' and nothing else. It
> needs `id' to recognize the user's uid and gid. If you could tell me,
> what the counterparts of the respective commands are on the remote host,
> I could teach Tramp to use them. Tramp needs to call the following
> commands, which would require a replacement:

Hi Michael,


for sorry I didn't find any counterparts of the respective commands on
the remote host. I investigated /etc/passwd and see that all users which
I need (for login or file modifications) has 0 uid and 0 guid. So all
users which I need are roots. All files on the remote host belongs to
root:wheel.

So, the following commands could return such values:

> 
> # id -u

0

> # id -un

a) Client's username (on remote host there are such usernames as
usernames on client hosts from which I will be used Tramp) 

b) 'testuser' (there is such 'test' username on the remote host).  

c) Hmmm... Or it can be just a 'root'?..

'testuser' -- seems will be suitable enough.

> # id -g

0

> # id -gn

wheel


Could these values be used by Tramp as constants? In other case I could just
create a little bash script which will return all these values. However
seems constants is more preferable as in case of script I'll be needed
to always upload it on the remote host.


Best regards,
Andrey


> 
> > Best regards,
> > Andrey
> 
> Best regards, Michael.

___
Tramp-devel mailing list
Tramp-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/tramp-devel


Re: Connect to the ssh and execute any command

2013-09-18 Thread Michael Albinus
yary  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?

> -y

Best regards, Michael.

___
Tramp-devel mailing list
Tramp-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/tramp-devel


Re: Connect to the ssh and execute any command

2013-09-18 Thread yary
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($))'
-y


On Wed, Sep 18, 2013 at 6:09 AM, Michael Albinus  wrote:
> Andrey Tykhonov  writes:
>
>> Hi Michael!
>
> Hi Andrey,
>
>> This is not surprise for me as such hosts are very custom. They are not
>> sterling FreeBSD. I'm not sure if I can install something there. But
>> even I can then I'll be needed to install these things again, again and
>> again, because such hosts has very short life, they reinstalls very
>> often, from the scratch, from template which I'm not able to change...
>
> I see. However, Tramp is not fixed to use `id' and nothing else. It
> needs `id' to recognize the user's uid and gid. If you could tell me,
> what the counterparts of the respective commands are on the remote host,
> I could teach Tramp to use them. Tramp needs to call the following
> commands, which would require a replacement:
>
> # id -u
> # id -un
> # id -g
> # id -gn
>
>> Best regards,
>> Andrey
>
> Best regards, Michael.
>
> ___
> Tramp-devel mailing list
> Tramp-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/tramp-devel

___
Tramp-devel mailing list
Tramp-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/tramp-devel


Re: Connect to the ssh and execute any command

2013-09-18 Thread Michael Albinus
Andrey Tykhonov  writes:

> Hi Michael!

Hi Andrey,

> This is not surprise for me as such hosts are very custom. They are not
> sterling FreeBSD. I'm not sure if I can install something there. But
> even I can then I'll be needed to install these things again, again and
> again, because such hosts has very short life, they reinstalls very
> often, from the scratch, from template which I'm not able to change...

I see. However, Tramp is not fixed to use `id' and nothing else. It
needs `id' to recognize the user's uid and gid. If you could tell me,
what the counterparts of the respective commands are on the remote host,
I could teach Tramp to use them. Tramp needs to call the following
commands, which would require a replacement:

# id -u
# id -un
# id -g
# id -gn

> Best regards,
> Andrey

Best regards, Michael.

___
Tramp-devel mailing list
Tramp-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/tramp-devel