[SOLVED] Trying to kill a Firefox window through remote ssh session
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Trying to kill a Firefox window through remote ssh session
Hello,
I am lost as to what command I can use to kill a Firefox window through a remote ssh session. I have a Linux machine running openSuse 12.1 that I use here at work for our lobby t.v. I have crontab set to open Firefox first thing in the morning and when it does that Firefox, due to the web address that it is pointed too, opens a total of three windows, only two of which i actually need displayed. So my question is what terminal command can I use to kill the one window I do not need? I would like to be able to eventually add the command to the .sh script I wrote to open Firefox.
No it does not return anything like that. After reading my post I realized I did not explain that very clearly. Firefox's home page is set to an internal web address http://xxx.xxxxx.xxx/xxx/luanch.php (sorry for security reasons cant give the whole address), from there it opens two additional windows that have the actual info that I want displayed, conference schedules, contact info and so on. The original window just stays a blank grey screen that to be honest is doing nothing and for cleanliness I would like to be able to close it and just have the two windows open that are needed. I remote into this box using PuTTY so I would like to be able to do this through the terminal.
I think the way is to identify the window (by title) and send a close command. You can try wmctrl so implement it.
I have installed this program and when I try to use it all I get is 'Cannot open display' I have tried using wmctrl -F -c <window name> as well as /usr/bin/wmctrl -F -c <window name>, both give me the same message Cannot open display.
that means you do not have access right to that DISPLAY. In this case there is no way to identify the window, there is no way to send events to that window manager, you can only kill the process (firefox) itself. You need to give access right to that user...
I think the way is to identify the window (by title) and send a close command. You can try wmctrl so implement it.
Thank you for letting me know about this command. I was finally able to get it to work and close out the window I wanted it to close. I forgot that since I was running this command remotely that I had to first tell it what display it was, Adding DISPLAY=:0 to the beginning of the command made it work with no further issues. Thanks again
Ok so then how would I go about giving access to it through an ssh session? Still pretty new to Linux.
This is not possible in general. You cannot give yourself access rights to another display, the owner of that display can give you access with the command xhost. In your case the user was the same and therefore you did not need to set additional rights but the DISPLAY variable. ssh does not know about that session.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.