-1

How do you open a Linux shell on a browser in order to explore it? Similar to how you can explore windows files with the "file://" path.

Basically I'm trying to find a way to browse through directories and files on my linux machine, SUSE, that's accessed through a putty, on an explorer like fashion.

I've looked into xdg-open, I almost had luck with webbrowser.open(url) but that opens w3m instead of any browser like chrome,firefox. xdg-open doesn't work, I keep getting:

    >>> /usr/bin/xdg-open: line 306: xprop: command not found
    /usr/bin/xdg-open: line 370: firefox: command not found
    /usr/bin/xdg-open: line 370: mozilla: command not found
    /usr/bin/xdg-open: line 370: netscape: command not found

Any suggestions on how this can be done would be appreciated! If there's a way to do this via Python, please let me know!

EDITED:

I get w3m when I use the webbrowser module on Python. I want to browse the linux directories in a GUI fashion. Just like you would do with Windows directories/files.

xdg-open isn't working at all for me.

4
  • 2
    file:///home/username/
    – DopeGhoti
    Nov 1, 2016 at 18:31
  • It's not at all clear to me what you are trying to achieve. Since you mention putty, I suppose that you want to access files on some machine from a Windows machine (using a web browser). However, on the other hand, you try to open a web browser from a unix-like machine. I am lost.
    – trosos
    Nov 1, 2016 at 18:46
  • Show us some python code (i.e. success open w3m VS failed with other application) in your question.
    – 林果皞
    Nov 1, 2016 at 18:48
  • So you are using an SSH-mediated terminal to access your Linux machine, you don't have any GUI WWW browsers installed on it at all, you're not physically at its console ... and you want to know how to invoke a GUI WWW browser? Or do you simply want to know if there's some sort of (TUI) (orthodox) file manager that you can use in your PuTTY terminal?
    – JdeBP
    Nov 1, 2016 at 19:34

3 Answers 3

1

To mount a directory on a remote machine as a virtual drive on a Windows machine over SSH, you can use Dokan SSHFS.

It would then be possible to access them using any file manager as well as your web browser.

However, Dokan SSHFS doesn't use putty: it uses its own implementation of the SSH protocol instead.

1

If you mean a web browser and you want to browse files rather than have shell access then many web browsers do display a directory listing if you point them to a file://… URL that points to a directory. You can do it in w3m. But that's for local files only — for remote files the web browser can only access what a web server feeds it. And web browsers are pretty bad at browsing directories: you should use a file manager for that.

If you want to access remote files then you need to use some kind of network file sharing protocol. Since you're using PuTTY and mention “explorer” as a reference, I assume that you're using Windows. On Windows the simple options for remote file access are pretty limited; SMB is built in and nothing else is simple to set up. So if you want to browse files in Windows Explorer (i.e. in a file manager, not a web browser), set up Samba on your Linux machine. Install the samba package and edit the configuration to authorize your Windows machine as a client (see the documentation).

If you want to run a GUI application on Linux and have it display on the Windows machine, you need to run an X server on Windows and enable X forwarding in PuTTY. See e.g. How to use X11 forwarding with PuTTY And you'll need to install the applications you want to run, of course.

0

When you use file:// on a Windows computer, you're accessing the LOCAL filesystem. That is, the web browser, the files, and your keyboard are all part of a single computer.

When you're using PuTTY, there's two computers - your Windows workstation, and your Linux box. xdg-open is meant to open a file on the Linux box using an application installed on the Linux box. It will NOT open a file stored on the Linux box using your Windows applications.

To do what you're trying to do, you have two options.

  • Do what @trosos suggests - mount the Linux filesystem with SSHFS, so it appears as a drive letter on Windows.
  • Install web server software like Apache on the Linux box and access it via the web server.

Not the answer you're looking for? Browse other questions tagged .