Jump to content

Auto Script To Invoke / Enable X11 Forwarding. - (Moved)


Recommended Posts

Team,

I am new to Autoit scripting. I need a script to invoke (enable) x11 in my machine(putty configurations). I am an cyberark guy. We are on-boarding Linux server into cyberark . This servers as x11 configured. All i need is to develop a script to activate the x11 in Putty configurations. Can anyone help?

Thanks!

Link to comment
Share on other sites

Simply add line "ForwardX11 yes" to your configuration file. Details can be found here: https://www.nics.tennessee.edu/x11_forwarding

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

aaaa ok i think you can use  many thing  for do  ssh -X <host>

also crete a link of putty in desktop  rename puttyX11  and  with right mouse click over icon

and insert a command ssh -X <host>

or 

if  you want  by autoit   you can  copy example of command run  in help F1

and substitute like this

Example()

Func Example()
    ; Run Notepad with the window maximized.
    substitute ----> Local $iPID = Run("notepad.exe", "", @SW_SHOWMAXIMIZED)

To run DOS (console) commands, try Run(@ComSpec & " /c " & 'commandName', "", @SW_HIDE)    ; don't forget " " before "/c"

    ; Wait 10 seconds for the Notepad window to appear.
    ;WinWait("[CLASS:Notepad]", "", 10)

    ; Wait for 2 seconds.
    Sleep(2000)

    ; Close the Notepad process using the PID returned by Run.
    ProcessClose($iPID)
EndFunc   ;==>Example

yopu can able putty also directly

Graphical Menu: Many SSH clients have a menu to change the configuration settings. For example, to change the setting in PuTTY, check the box next to

Connection --> SSH --> X11 --> Enable X11 Forwarding
Edited by faustf
Link to comment
Share on other sites

28 minutes ago, faustf said:

i dont understund  what you wanna  do

so explain better please 

1  you are in windows  open a putty and you wanna invoke X11 ?

 

I need a Autoit script to Launch X11 when i access linux server. When i say launch X11 - This involves the Putty configuration (Like - SSH --> X11 --> Enable X11 Forwarding (enabling checkbox)) 

 

11 minutes ago, faustf said:

aaaa ok i think you can use  many thing  for do  ssh -X <host>

also crete a link of putty in desktop  rename puttyX11  and  with right mouse click over icon

and insert a command ssh -X <host>

or 

35 minutes ago, water said:

Simply add line "ForwardX11 yes" to your configuration file. Details can be found here: https://www.nics.tennessee.edu/x11_forwarding

47 minutes ago, faustf said:

i dont understund  what you wanna  do

so explain better please 

1  you are in windows  open a putty and you wanna invoke X11 ?

 

if  you want  by autoit   you can  copy example of command run  in help F1

and substitute like this

Example()

Func Example()
    ; Run Notepad with the window maximized.
    substitute ----> Local $iPID = Run("notepad.exe", "", @SW_SHOWMAXIMIZED)

To run DOS (console) commands, try Run(@ComSpec & " /c " & 'commandName', "", @SW_HIDE)    ; don't forget " " before "/c"

    ; Wait 10 seconds for the Notepad window to appear.
    ;WinWait("[CLASS:Notepad]", "", 10)

    ; Wait for 2 seconds.
    Sleep(2000)

    ; Close the Notepad process using the PID returned by Run.
    ProcessClose($iPID)
EndFunc   ;==>Example

yopu can able putty also directly

Graphical Menu: Many SSH clients have a menu to change the configuration settings. For example, to change the setting in PuTTY, check the box next to


Connection --> SSH --> X11 --> Enable X11 Forwarding

inside cyberark i cannot enable the x11. Cyberark is Privilege access management tool used to access servers and privilege accounts securely. This linux is already enabled with x11 configurations. Server configuration end we are good. 

So inside cyberark when i open this server 

Link to comment
Share on other sites

inside cyberark i cannot enable the x11. Cyberark is Privilege access management tool used to access servers and privilege accounts securely. This linux server is already enabled with x11 configurations. Server configuration end we are good. 

So inside cyberark when i open this linux server, my autoit should launch the x11. When i say launch X11 - This involves the Putty configuration (Like - SSH --> X11 --> Enable X11 Forwarding (enabling checkbox)) 

I need a Autoit script to Launch X11 when i access linux server.

Link to comment
Share on other sites

Thanks faustf. Help me understand.

I am creating script.txt on my putty folder, In cyberark, I will be using this path c:\program files\putty\script.txt to retrieve x11. 

 

But i dont know how to write script to enable x11. Is there any sample available?or format to develop a script. Moreover how do i test this script. I am sorry i am asking at very low level.

Link to comment
Share on other sites

Just to make sure we correctly understand your goal:

  • Putty gets started by CyberArk
  • When putty connects to a linux server, X11 should be enabled by a script.
  • This script needs to run on your PC

Correct?

If yes I have a few more questions:

  • How would your script determine that CyberArk tries to connect to a linux machine?
  • At the moment you are able to manually set X11 when CyberArk starts a linux session?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

18 minutes ago, water said:

.How would your script determine that CyberArk tries to connect to a linux machine?

Response: Through a connection component i will invoke this script from cyberark. Example: I have a component called PSM-SSH, i will give the path for this script in cyberark
so when i hit connect to the server in cyberark, it will go to my Cyberark server and execute the script that is present in this path(c:\program files\putty\script.txt). 


.At the moment you are able to manually set X11 when CyberArk starts a linux session?
Response - Correct. When i use a putty session i enable the x11 manually. What i am seeking here is how to set up x11 enabled in a putty file using autoit script? 
so that i can use this Autoit script in cyberark to establish connection to destinated linux server.

That is correct. Please find my response below:

  • 1 hour ago, Kingz said:

    Thanks faustf. Help me understand.

    I am creating script.txt on my putty folder, In cyberark, I will be using this path c:\program files\putty\script.txt to retrieve x11. 

     

    But i dont know how to write script to enable x11. Is there any sample available?or format to develop a script. Moreover how do i test this script. I am sorry i am asking at very low level.

     

Link to comment
Share on other sites

45 minutes ago, water said:

At the moment you are able to manually set X11 when CyberArk starts a linux session?

No . What i am seeking here is how to set up x11 enabled in a putty file using autoit script? 
so that i can use this Autoit script in cyberark to establish connection to destinated linux server.

Link to comment
Share on other sites

  • Developers
15 minutes ago, Kingz said:

Run (c:\program_files\xming\x11\x11.exe)

This can't be your actual run statement in your script as there are multiple issues with that...right?

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

4 minutes ago, Jos said:

This can't be your actual run statement in your script as there are multiple issues with that...right?

Jos

Yes Jos. I added this for reference. just to invoke x11 on machine.  Run ("c:\Program Files\Xming\Xming.exe")

Link to comment
Share on other sites

@Kingz Could you please stop using the "Quote" button when you want to reply to a post? Just enter your reply into the inputbox at the end of the thread and press "Submit Reply".
It's already hard enough to follow the discussion ;)
 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I - and I assume the rest of the users who try to assist you - are not familiar with Cyberark and your environment.
So you need to be as specific as possible so we can provide a possible solution.

  • How many parties are involved in this scenario?
    • Your Windows client,
    • the Linux server you want to connect to and
    • the Cyberarc server?
  • You are talking about "inside CyberArc" - is this the client component of the CyberArc product running on your PC?
  • You are talking about PUTTY and Xming.
    • On which of this parties (PC, Server) do you want to execute which program?
    • I assume XMing on the CyberArc Server and Putty on your PC.
  • I understand that the PUTTY configuration needs to be modified for X11.
    • Where is this configuration file located?
    • On your PC? In a location where you have write permission?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

so i think you  run after login a linux script not  , autoit , because you have a linux server

a simple script  will be   this

#!/bin/bash
sudo bash -c 'command1; command2; command3;'

bye

Edited by faustf
Link to comment
Share on other sites

  • 2 weeks later...

Team,

Can anyone share the script to enable / invoke x11 forrwading? How to write a script to enable x11 and access putty. 

 

When I execute the script, the script should enable x11 and connect to linux server. 

 

Thanks, 

Link to comment
Share on other sites

  • Developers

Moved to the appropriate forum, as the AutoIt Example Scripts forum very clearly states:

Quote

Share your cool AutoIt scripts, UDFs and applications with others.


Do not post general support questions here, instead use the AutoIt Help and Support forums.

Moderation Team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

You already have a thread where you ask the same question :huh2:

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...