[ 
https://issues.apache.org/jira/browse/SSHD-1298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17610584#comment-17610584
 ] 

sivaprasad commented on SSHD-1298:
----------------------------------

Hi Thomas, 

1. I manually ran the command by using the -S option on Linux, and it executed 
successfully. but When I run the same query with code it's not worked.

Manual execution snip in Linux.

!image-2022-09-28-19-05-00-814.png!

My Code flow

!image-2022-09-28-19-12-17-243.png!   

Below  error, i am getting when i ran the same command from the code side

----- in sudo ssh command execution.   -----

[sudo] password for ctadmin: Sorry, user ctadmin is not allowed to execute 
'/bin/su - oracle -c ls -lrt' as root on esx3ebs122603.

- status of command             : 1

----- out from sudo ssh command Execution.   -----

2.  I tried with a channel.invertedIn(), I feed the password, but it was 
stucked.

3.  I am a sudo user so my username and password are only for ssh connection, 
once i connected i need to check out the oracle user without giving the 
password. this is passwordless access for my user.  to checkout the oracle 
prompt for executing a command I am using both.

siva is a sudo user.

!image-2022-09-28-18-57-02-354.png!

4. I checked with my Unix team they set up/etc/sudoers properly.

!image-2022-09-28-18-59-16-962.png!

5. Once i executed the command manually in Linux if it is working then i will 
execute it with code.

All these things code and servers are on remote desktops,  we don't have the 
option to copy. So due to that, I am sharing screenshots instead of text. Sorry.

So my aim is,  once I open a session with my sudo username and password I need 
to check out the oracle user prompt to execute the commands. to check out the 
oracle prompt I no need to give a password it's passwordless access.

> password less sudo user commands execution and file.
> ----------------------------------------------------
>
>                 Key: SSHD-1298
>                 URL: https://issues.apache.org/jira/browse/SSHD-1298
>             Project: MINA SSHD
>          Issue Type: Improvement
>         Environment: Java 1.8, Linux, Solaris.
>            Reporter: sivaprasad
>            Priority: Blocker
>         Attachments: image-2022-09-23-18-01-38-617.png, 
> image-2022-09-23-18-02-25-225.png, image-2022-09-23-18-04-29-364.png, 
> image-2022-09-27-19-34-06-130.png, image-2022-09-28-18-55-13-239.png, 
> image-2022-09-28-18-57-02-354.png, image-2022-09-28-18-59-16-962.png, 
> image-2022-09-28-19-05-00-814.png, image-2022-09-28-19-08-56-706.png, 
> image-2022-09-28-19-12-17-243.png
>
>
> Hi Team,
> To establish the Session connection, I am using a regular username(siva) and 
> password(siva).  once a session is created successfully, by using the same 
> session I need to check out another sudo user 'oracle' to execute a command 
> on Linux or Solaris, why is because this oracle user(passwordless access for 
> this user) has those permissions to execute commands. here i  attached the 
> sample code i am using now. but it is working in some cases only. sometimes 
> commands are giving 1 as existstatus and the error stream throws an error 
> message even though I allocated pty to the session properly. someone, please 
> help me how to overcome this. 
> !image-2022-09-23-18-04-29-364.png!
>  
> !image-2022-09-23-18-01-38-617.png!
>  
> !image-2022-09-23-18-02-25-225.png!
>  
> is there any better way to handle sudo user related command execution, file 
> upload and downloads with Apachemina?
>  
> Thanks,
> Siva
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org

Reply via email to