Open file from remote computer on host computer

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
23
down vote

favorite
10












I'm trying to edit a file from a remote computer connected via ssh. How can I open the remote file on my local computer to edit?










share|improve this question

























    up vote
    23
    down vote

    favorite
    10












    I'm trying to edit a file from a remote computer connected via ssh. How can I open the remote file on my local computer to edit?










    share|improve this question























      up vote
      23
      down vote

      favorite
      10









      up vote
      23
      down vote

      favorite
      10






      10





      I'm trying to edit a file from a remote computer connected via ssh. How can I open the remote file on my local computer to edit?










      share|improve this question













      I'm trying to edit a file from a remote computer connected via ssh. How can I open the remote file on my local computer to edit?







      ssh remote






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 15 '15 at 15:42









      masterninja01

      128127




      128127




















          5 Answers
          5






          active

          oldest

          votes

















          up vote
          29
          down vote



          accepted










          You can mount the remote directory with sshfs, after that, the file is accessible in your local directory tree.



          Example:



          sshfs user@domain:/remote/directory/ /local/directory/


          It's all in the man pages.



          Or just copy the file over with scp/rsync, edit it, and copy it back.






          share|improve this answer


















          • 1




            When I try the 'sshfs' command it throws a "missing host" error. Any way around that? This is what I'm trying to do: sshfs USER@IP_ADDRESS//~/folder/folder_here/another_folder/file.txt Note: I didn't use a port number if that matters.
            – masterninja01
            Feb 15 '15 at 17:08







          • 1




            @masterninja01 You need to specify a local mount point; also, you can't mount the actual file, you would mount the directory (also: the source address needs to include a colon) so: sshfs USER@IP_ADDRESS:~/folder/ ~/folder. ~/folder needs to exist locally.
            – goldilocks
            Feb 15 '15 at 18:28


















          up vote
          8
          down vote













          If you are familiar with vim, you may use it as follows:



          vim scp://user@host:port/file_path_and_filename


          Make sure not to forget the "/" character before the filepath; otherwise it won't work; for example:



          vim scp://user@192.168.1.4:2243//home/user/my_file


          You can skip the portnumber if is the same of the default on your /etc/ssh/sshd_config file






          share|improve this answer


















          • 2




            Are the changes written back to server?
            – jnovacho
            Aug 8 '17 at 11:25










          • @jnovacho, I confirm that yes, changes are written back to the server. It works also with gvim.
            – Hans Deragon
            Jul 21 at 2:24

















          up vote
          6
          down vote













          If you use GNOME or KDE:



          • open file manager

          • press Ctrl+L to focus address bar

          • enter sftp://host/ and press Enter (replace "host" with your target host)

          The file system of the remote host will be displayed in file manager now, and you can navigate to your target directory and double-click the file to open it.
          As far as I know you can now use any local program to open the file (it doesn't have to be a Gnome or KDE application).



          You should also be able to set a bookmark to the remote target directory, to quickly get there again later.



          If you want to connect as a different user or using a different port, you can use sftp://user@host:port/somedirectory/.






          share|improve this answer





























            up vote
            3
            down vote













            During a ssh session you can just open the file with an editor, for example vi/vim or nano.



            $ vi file.txt


            If you're not sure how to use these, check the manpage.






            share|improve this answer





























              up vote
              3
              down vote













              If you want to use GUI programs installed on the remote machine, you can forward remote display to your local PC.



               $ ssh -X user@example.com


              Now open a remote file using a GUI editor installed on remote machine



               $ geany ~/Documents/file.txt





              share|improve this answer




















                Your Answer








                StackExchange.ready(function()
                var channelOptions =
                tags: "".split(" "),
                id: "106"
                ;
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function()
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled)
                StackExchange.using("snippets", function()
                createEditor();
                );

                else
                createEditor();

                );

                function createEditor()
                StackExchange.prepareEditor(
                heartbeatType: 'answer',
                convertImagesToLinks: false,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: null,
                bindNavPrevention: true,
                postfix: "",
                imageUploader:
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                ,
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                );



                );













                 

                draft saved


                draft discarded


















                StackExchange.ready(
                function ()
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f184965%2fopen-file-from-remote-computer-on-host-computer%23new-answer', 'question_page');

                );

                Post as a guest






























                5 Answers
                5






                active

                oldest

                votes








                5 Answers
                5






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                29
                down vote



                accepted










                You can mount the remote directory with sshfs, after that, the file is accessible in your local directory tree.



                Example:



                sshfs user@domain:/remote/directory/ /local/directory/


                It's all in the man pages.



                Or just copy the file over with scp/rsync, edit it, and copy it back.






                share|improve this answer


















                • 1




                  When I try the 'sshfs' command it throws a "missing host" error. Any way around that? This is what I'm trying to do: sshfs USER@IP_ADDRESS//~/folder/folder_here/another_folder/file.txt Note: I didn't use a port number if that matters.
                  – masterninja01
                  Feb 15 '15 at 17:08







                • 1




                  @masterninja01 You need to specify a local mount point; also, you can't mount the actual file, you would mount the directory (also: the source address needs to include a colon) so: sshfs USER@IP_ADDRESS:~/folder/ ~/folder. ~/folder needs to exist locally.
                  – goldilocks
                  Feb 15 '15 at 18:28















                up vote
                29
                down vote



                accepted










                You can mount the remote directory with sshfs, after that, the file is accessible in your local directory tree.



                Example:



                sshfs user@domain:/remote/directory/ /local/directory/


                It's all in the man pages.



                Or just copy the file over with scp/rsync, edit it, and copy it back.






                share|improve this answer


















                • 1




                  When I try the 'sshfs' command it throws a "missing host" error. Any way around that? This is what I'm trying to do: sshfs USER@IP_ADDRESS//~/folder/folder_here/another_folder/file.txt Note: I didn't use a port number if that matters.
                  – masterninja01
                  Feb 15 '15 at 17:08







                • 1




                  @masterninja01 You need to specify a local mount point; also, you can't mount the actual file, you would mount the directory (also: the source address needs to include a colon) so: sshfs USER@IP_ADDRESS:~/folder/ ~/folder. ~/folder needs to exist locally.
                  – goldilocks
                  Feb 15 '15 at 18:28













                up vote
                29
                down vote



                accepted







                up vote
                29
                down vote



                accepted






                You can mount the remote directory with sshfs, after that, the file is accessible in your local directory tree.



                Example:



                sshfs user@domain:/remote/directory/ /local/directory/


                It's all in the man pages.



                Or just copy the file over with scp/rsync, edit it, and copy it back.






                share|improve this answer














                You can mount the remote directory with sshfs, after that, the file is accessible in your local directory tree.



                Example:



                sshfs user@domain:/remote/directory/ /local/directory/


                It's all in the man pages.



                Or just copy the file over with scp/rsync, edit it, and copy it back.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Feb 15 '15 at 19:57

























                answered Feb 15 '15 at 16:30









                orion

                9,0131733




                9,0131733







                • 1




                  When I try the 'sshfs' command it throws a "missing host" error. Any way around that? This is what I'm trying to do: sshfs USER@IP_ADDRESS//~/folder/folder_here/another_folder/file.txt Note: I didn't use a port number if that matters.
                  – masterninja01
                  Feb 15 '15 at 17:08







                • 1




                  @masterninja01 You need to specify a local mount point; also, you can't mount the actual file, you would mount the directory (also: the source address needs to include a colon) so: sshfs USER@IP_ADDRESS:~/folder/ ~/folder. ~/folder needs to exist locally.
                  – goldilocks
                  Feb 15 '15 at 18:28













                • 1




                  When I try the 'sshfs' command it throws a "missing host" error. Any way around that? This is what I'm trying to do: sshfs USER@IP_ADDRESS//~/folder/folder_here/another_folder/file.txt Note: I didn't use a port number if that matters.
                  – masterninja01
                  Feb 15 '15 at 17:08







                • 1




                  @masterninja01 You need to specify a local mount point; also, you can't mount the actual file, you would mount the directory (also: the source address needs to include a colon) so: sshfs USER@IP_ADDRESS:~/folder/ ~/folder. ~/folder needs to exist locally.
                  – goldilocks
                  Feb 15 '15 at 18:28








                1




                1




                When I try the 'sshfs' command it throws a "missing host" error. Any way around that? This is what I'm trying to do: sshfs USER@IP_ADDRESS//~/folder/folder_here/another_folder/file.txt Note: I didn't use a port number if that matters.
                – masterninja01
                Feb 15 '15 at 17:08





                When I try the 'sshfs' command it throws a "missing host" error. Any way around that? This is what I'm trying to do: sshfs USER@IP_ADDRESS//~/folder/folder_here/another_folder/file.txt Note: I didn't use a port number if that matters.
                – masterninja01
                Feb 15 '15 at 17:08





                1




                1




                @masterninja01 You need to specify a local mount point; also, you can't mount the actual file, you would mount the directory (also: the source address needs to include a colon) so: sshfs USER@IP_ADDRESS:~/folder/ ~/folder. ~/folder needs to exist locally.
                – goldilocks
                Feb 15 '15 at 18:28





                @masterninja01 You need to specify a local mount point; also, you can't mount the actual file, you would mount the directory (also: the source address needs to include a colon) so: sshfs USER@IP_ADDRESS:~/folder/ ~/folder. ~/folder needs to exist locally.
                – goldilocks
                Feb 15 '15 at 18:28













                up vote
                8
                down vote













                If you are familiar with vim, you may use it as follows:



                vim scp://user@host:port/file_path_and_filename


                Make sure not to forget the "/" character before the filepath; otherwise it won't work; for example:



                vim scp://user@192.168.1.4:2243//home/user/my_file


                You can skip the portnumber if is the same of the default on your /etc/ssh/sshd_config file






                share|improve this answer


















                • 2




                  Are the changes written back to server?
                  – jnovacho
                  Aug 8 '17 at 11:25










                • @jnovacho, I confirm that yes, changes are written back to the server. It works also with gvim.
                  – Hans Deragon
                  Jul 21 at 2:24














                up vote
                8
                down vote













                If you are familiar with vim, you may use it as follows:



                vim scp://user@host:port/file_path_and_filename


                Make sure not to forget the "/" character before the filepath; otherwise it won't work; for example:



                vim scp://user@192.168.1.4:2243//home/user/my_file


                You can skip the portnumber if is the same of the default on your /etc/ssh/sshd_config file






                share|improve this answer


















                • 2




                  Are the changes written back to server?
                  – jnovacho
                  Aug 8 '17 at 11:25










                • @jnovacho, I confirm that yes, changes are written back to the server. It works also with gvim.
                  – Hans Deragon
                  Jul 21 at 2:24












                up vote
                8
                down vote










                up vote
                8
                down vote









                If you are familiar with vim, you may use it as follows:



                vim scp://user@host:port/file_path_and_filename


                Make sure not to forget the "/" character before the filepath; otherwise it won't work; for example:



                vim scp://user@192.168.1.4:2243//home/user/my_file


                You can skip the portnumber if is the same of the default on your /etc/ssh/sshd_config file






                share|improve this answer














                If you are familiar with vim, you may use it as follows:



                vim scp://user@host:port/file_path_and_filename


                Make sure not to forget the "/" character before the filepath; otherwise it won't work; for example:



                vim scp://user@192.168.1.4:2243//home/user/my_file


                You can skip the portnumber if is the same of the default on your /etc/ssh/sshd_config file







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 9 mins ago









                KiriSakow

                53




                53










                answered Feb 15 '15 at 16:10









                dgsleeps

                66457




                66457







                • 2




                  Are the changes written back to server?
                  – jnovacho
                  Aug 8 '17 at 11:25










                • @jnovacho, I confirm that yes, changes are written back to the server. It works also with gvim.
                  – Hans Deragon
                  Jul 21 at 2:24












                • 2




                  Are the changes written back to server?
                  – jnovacho
                  Aug 8 '17 at 11:25










                • @jnovacho, I confirm that yes, changes are written back to the server. It works also with gvim.
                  – Hans Deragon
                  Jul 21 at 2:24







                2




                2




                Are the changes written back to server?
                – jnovacho
                Aug 8 '17 at 11:25




                Are the changes written back to server?
                – jnovacho
                Aug 8 '17 at 11:25












                @jnovacho, I confirm that yes, changes are written back to the server. It works also with gvim.
                – Hans Deragon
                Jul 21 at 2:24




                @jnovacho, I confirm that yes, changes are written back to the server. It works also with gvim.
                – Hans Deragon
                Jul 21 at 2:24










                up vote
                6
                down vote













                If you use GNOME or KDE:



                • open file manager

                • press Ctrl+L to focus address bar

                • enter sftp://host/ and press Enter (replace "host" with your target host)

                The file system of the remote host will be displayed in file manager now, and you can navigate to your target directory and double-click the file to open it.
                As far as I know you can now use any local program to open the file (it doesn't have to be a Gnome or KDE application).



                You should also be able to set a bookmark to the remote target directory, to quickly get there again later.



                If you want to connect as a different user or using a different port, you can use sftp://user@host:port/somedirectory/.






                share|improve this answer


























                  up vote
                  6
                  down vote













                  If you use GNOME or KDE:



                  • open file manager

                  • press Ctrl+L to focus address bar

                  • enter sftp://host/ and press Enter (replace "host" with your target host)

                  The file system of the remote host will be displayed in file manager now, and you can navigate to your target directory and double-click the file to open it.
                  As far as I know you can now use any local program to open the file (it doesn't have to be a Gnome or KDE application).



                  You should also be able to set a bookmark to the remote target directory, to quickly get there again later.



                  If you want to connect as a different user or using a different port, you can use sftp://user@host:port/somedirectory/.






                  share|improve this answer
























                    up vote
                    6
                    down vote










                    up vote
                    6
                    down vote









                    If you use GNOME or KDE:



                    • open file manager

                    • press Ctrl+L to focus address bar

                    • enter sftp://host/ and press Enter (replace "host" with your target host)

                    The file system of the remote host will be displayed in file manager now, and you can navigate to your target directory and double-click the file to open it.
                    As far as I know you can now use any local program to open the file (it doesn't have to be a Gnome or KDE application).



                    You should also be able to set a bookmark to the remote target directory, to quickly get there again later.



                    If you want to connect as a different user or using a different port, you can use sftp://user@host:port/somedirectory/.






                    share|improve this answer














                    If you use GNOME or KDE:



                    • open file manager

                    • press Ctrl+L to focus address bar

                    • enter sftp://host/ and press Enter (replace "host" with your target host)

                    The file system of the remote host will be displayed in file manager now, and you can navigate to your target directory and double-click the file to open it.
                    As far as I know you can now use any local program to open the file (it doesn't have to be a Gnome or KDE application).



                    You should also be able to set a bookmark to the remote target directory, to quickly get there again later.



                    If you want to connect as a different user or using a different port, you can use sftp://user@host:port/somedirectory/.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Feb 16 '15 at 13:04









                    slm♦

                    242k66501669




                    242k66501669










                    answered Feb 16 '15 at 12:57









                    oliver

                    27614




                    27614




















                        up vote
                        3
                        down vote













                        During a ssh session you can just open the file with an editor, for example vi/vim or nano.



                        $ vi file.txt


                        If you're not sure how to use these, check the manpage.






                        share|improve this answer


























                          up vote
                          3
                          down vote













                          During a ssh session you can just open the file with an editor, for example vi/vim or nano.



                          $ vi file.txt


                          If you're not sure how to use these, check the manpage.






                          share|improve this answer
























                            up vote
                            3
                            down vote










                            up vote
                            3
                            down vote









                            During a ssh session you can just open the file with an editor, for example vi/vim or nano.



                            $ vi file.txt


                            If you're not sure how to use these, check the manpage.






                            share|improve this answer














                            During a ssh session you can just open the file with an editor, for example vi/vim or nano.



                            $ vi file.txt


                            If you're not sure how to use these, check the manpage.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Feb 15 '15 at 16:15

























                            answered Feb 15 '15 at 16:05









                            ulmer-a

                            1593




                            1593




















                                up vote
                                3
                                down vote













                                If you want to use GUI programs installed on the remote machine, you can forward remote display to your local PC.



                                 $ ssh -X user@example.com


                                Now open a remote file using a GUI editor installed on remote machine



                                 $ geany ~/Documents/file.txt





                                share|improve this answer
























                                  up vote
                                  3
                                  down vote













                                  If you want to use GUI programs installed on the remote machine, you can forward remote display to your local PC.



                                   $ ssh -X user@example.com


                                  Now open a remote file using a GUI editor installed on remote machine



                                   $ geany ~/Documents/file.txt





                                  share|improve this answer






















                                    up vote
                                    3
                                    down vote










                                    up vote
                                    3
                                    down vote









                                    If you want to use GUI programs installed on the remote machine, you can forward remote display to your local PC.



                                     $ ssh -X user@example.com


                                    Now open a remote file using a GUI editor installed on remote machine



                                     $ geany ~/Documents/file.txt





                                    share|improve this answer












                                    If you want to use GUI programs installed on the remote machine, you can forward remote display to your local PC.



                                     $ ssh -X user@example.com


                                    Now open a remote file using a GUI editor installed on remote machine



                                     $ geany ~/Documents/file.txt






                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Feb 15 '15 at 23:18









                                    Dunga

                                    311




                                    311



























                                         

                                        draft saved


                                        draft discarded















































                                         


                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function ()
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f184965%2fopen-file-from-remote-computer-on-host-computer%23new-answer', 'question_page');

                                        );

                                        Post as a guest













































































                                        Popular posts from this blog

                                        How to check contact read email or not when send email to Individual?

                                        Displaying single band from multi-band raster using QGIS

                                        How many registers does an x86_64 CPU actually have?