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

sivaprasad edited comment on SSHD-1298 at 9/29/22 1:22 PM:
-----------------------------------------------------------

I tried as you said but still got the same issues. previously  we used a jscape 
to execute ssh commands. jscape has a session.sendwait method it can handle 
these things. recently we migrated to apache mina, for regular users mina 
working as expected, but here are issues with sudo users only.

----- in ctssh sudo command execution.   -----

[sudo] password for siva:
Sorry, user siva is not allowed to execute '/bin/su - oracle -c ls -lrt' as 
root on esx3ebs122603.
 - exit status of command        : 1
 -- 
 --- 
 ---- 
 ----- out from ctssh sudo command execution.   -----

When I ran the same command with jscape below is the output

[siva@esx3ebs122603~]$ Last login: Sat Jul 30 05:31:23 CDT 2022^M
[oracle@esx3ebs122603~]$ total 40^M
drwxrwxrwx. 2 oracle oinstall 4096 Jun  1 12:21 template^M
drwxrwxrwx. 2 oracle oinstall 4096 Jun  1 12:21 patches^M
drwxrwxrwx. 2 oracle oinstall 4096 Jun  1 12:21 bak^M
drwxrwxrwx. 2 oracle oinstall 4096 Jun  1 12:21 conf^M
drwxrwxrwx. 2 oracle oinstall 4096 Jun  1 12:21 dumps^M
drwxrwxrwx. 3 oracle oinstall 4096 Jun  3 01:27 bin^M
drwxrwxrwx. 3 oracle oinstall 8192 Jul 30 02:02 out^M
drwxrwxrwx. 2 oracle oinstall 4096 Jul 30 05:30 sql^M
[oracle@esx3ebs122603~]$ 0^M
[oracle@esx3ebs122603~]$ ===================0^M
[oracle@esx3ebs122603~]$
 * 
 ** 
 *** Status of command from jscape is: 0^M

please let me know if anything wrong in mycode.

!image-2022-09-29-18-52-06-070.png!

 


was (Author: JIRAUSER295690):
I tried as you said but still got the same issues. previously  we used a jscape 
to execute ssh commands. jscape has a session.sendwait method it can handle 
these things. recently we migrated to apache mina, for regular users mina 
working as expected, but here are issues with sudo users only.

----- in ctssh sudo command execution.   -----

[sudo] password for siva:
Sorry, user siva is not allowed to execute '/bin/su - oracle -c ls -lrt' as 
root on esx3ebs122603.
- exit status of command        : 1
----- out from ctssh sudo command execution.   -----

When I ran the same command with jscape below is the output

[siva@esx3ebs122603~]$ Last login: Sat Jul 30 05:31:23 CDT 2022^M
[oracle@esx3ebs122603~]$ total 40^M
drwxrwxrwx. 2 oracle oinstall 4096 Jun  1 12:21 template^M
drwxrwxrwx. 2 oracle oinstall 4096 Jun  1 12:21 patches^M
drwxrwxrwx. 2 oracle oinstall 4096 Jun  1 12:21 bak^M
drwxrwxrwx. 2 oracle oinstall 4096 Jun  1 12:21 conf^M
drwxrwxrwx. 2 oracle oinstall 4096 Jun  1 12:21 dumps^M
drwxrwxrwx. 3 oracle oinstall 4096 Jun  3 01:27 bin^M
drwxrwxrwx. 3 oracle oinstall 8192 Jul 30 02:02 out^M
drwxrwxrwx. 2 oracle oinstall 4096 Jul 30 05:30 sql^M
[oracle@esx3ebs122603~]$ 0^M
[oracle@esx3ebs122603~]$ ===================0^M
[oracle@esx3ebs122603~]$
*** Status of command from jscape is: 0^M

please let me know if anything wrong in mycode.

!image-2022-09-29-16-19-49-398.png!  

 

> 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-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-12-17-243.png, image-2022-09-29-18-52-06-070.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