Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Remote access recommendations

Remote access recommendations

Scheduled Pinned Locked Moved The Lounge
databasepostgresqllinux
26 Posts 7 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • pkfoxP pkfox

    Hi all, I need to remotely access my home Linux hosted Postgresql database remotely - I'm thinking maybe a VPN is the way to go but thought I'd ask you lot first

    "We can't stop here - this is bat country" - Hunter S Thompson - RIP

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #2

    I do similar and yes I use VPN for it. From my point of view an easy way and especially a very secure way.

    It does not solve my Problem, but it answers my question

    pkfoxP 1 Reply Last reply
    0
    • pkfoxP pkfox

      Hi all, I need to remotely access my home Linux hosted Postgresql database remotely - I'm thinking maybe a VPN is the way to go but thought I'd ask you lot first

      "We can't stop here - this is bat country" - Hunter S Thompson - RIP

      M Offline
      M Offline
      Mark_Wallace
      wrote on last edited by
      #3

      Were you seriously considering doing it without a VPN? If so, your ideas may require some revision. It ain't rocket surgery; you'll get the drift within a couple of hours.

      I wanna be a eunuchs developer! Pass me a bread knife!

      pkfoxP 1 Reply Last reply
      0
      • M Mark_Wallace

        Were you seriously considering doing it without a VPN? If so, your ideas may require some revision. It ain't rocket surgery; you'll get the drift within a couple of hours.

        I wanna be a eunuchs developer! Pass me a bread knife!

        pkfoxP Offline
        pkfoxP Offline
        pkfox
        wrote on last edited by
        #4

        No I wasn’t that’s why I’m asking here 😩

        "We can't stop here - this is bat country" - Hunter S Thompson - RIP

        M 1 Reply Last reply
        0
        • pkfoxP pkfox

          Hi all, I need to remotely access my home Linux hosted Postgresql database remotely - I'm thinking maybe a VPN is the way to go but thought I'd ask you lot first

          "We can't stop here - this is bat country" - Hunter S Thompson - RIP

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #5

          Hi, Wireguard[^] is quickly becoming the industry standard. The whitepaper is here[^]. You should invest a few minutes researching it. Best Wishes, -David Delaune

          S pkfoxP 2 Replies Last reply
          0
          • L Lost User

            Hi, Wireguard[^] is quickly becoming the industry standard. The whitepaper is here[^]. You should invest a few minutes researching it. Best Wishes, -David Delaune

            S Offline
            S Offline
            Southmountain
            wrote on last edited by
            #6

            this is great info. thanks.

            diligent hands rule....

            1 Reply Last reply
            0
            • pkfoxP pkfox

              No I wasn’t that’s why I’m asking here 😩

              "We can't stop here - this is bat country" - Hunter S Thompson - RIP

              M Offline
              M Offline
              Mark_Wallace
              wrote on last edited by
              #7

              pkfox wrote:

              No I wasn’t that’s why I’m asking here 😩

              Cool.  I can't fault you for asking (I end up telling people how to use the stuff we make, so I'm something of an expert on asking stupid questions -- which are a Good Thing). Yes, you should use VPNs.  If you hear otherwise, people are giving you bad, and very dangerous, advice. Randor has suggested a solution I would seriously consider to use in what seems to be your problem space, so I would follow his suggestion, and also search on similar solutions (using keywords given by Randor and the site he suggests), to make a decision after looking into it with an eye on what fits your situation best. If you're not sure, though, don't make a decision on what might seem right.  It's rare to find two places with identical problems that fit the same pre-made solution, so look at everything available, before making a decision. Good luck, and kudos for asking for advice before jumping in.

              I wanna be a eunuchs developer! Pass me a bread knife!

              D pkfoxP 2 Replies Last reply
              0
              • M Mark_Wallace

                pkfox wrote:

                No I wasn’t that’s why I’m asking here 😩

                Cool.  I can't fault you for asking (I end up telling people how to use the stuff we make, so I'm something of an expert on asking stupid questions -- which are a Good Thing). Yes, you should use VPNs.  If you hear otherwise, people are giving you bad, and very dangerous, advice. Randor has suggested a solution I would seriously consider to use in what seems to be your problem space, so I would follow his suggestion, and also search on similar solutions (using keywords given by Randor and the site he suggests), to make a decision after looking into it with an eye on what fits your situation best. If you're not sure, though, don't make a decision on what might seem right.  It's rare to find two places with identical problems that fit the same pre-made solution, so look at everything available, before making a decision. Good luck, and kudos for asking for advice before jumping in.

                I wanna be a eunuchs developer! Pass me a bread knife!

                D Offline
                D Offline
                dandy72
                wrote on last edited by
                #8

                Mark_Wallace wrote:

                Yes, you should use VPNs.  If you hear otherwise, people are giving you bad, and very dangerous, advice.

                Well, he would be able to access his database. Including many others...

                1 Reply Last reply
                0
                • L Lost User

                  Hi, Wireguard[^] is quickly becoming the industry standard. The whitepaper is here[^]. You should invest a few minutes researching it. Best Wishes, -David Delaune

                  pkfoxP Offline
                  pkfoxP Offline
                  pkfox
                  wrote on last edited by
                  #9

                  Thanks very much I'll check it out

                  "We can't stop here - this is bat country" - Hunter S Thompson - RIP

                  1 Reply Last reply
                  0
                  • M Mark_Wallace

                    pkfox wrote:

                    No I wasn’t that’s why I’m asking here 😩

                    Cool.  I can't fault you for asking (I end up telling people how to use the stuff we make, so I'm something of an expert on asking stupid questions -- which are a Good Thing). Yes, you should use VPNs.  If you hear otherwise, people are giving you bad, and very dangerous, advice. Randor has suggested a solution I would seriously consider to use in what seems to be your problem space, so I would follow his suggestion, and also search on similar solutions (using keywords given by Randor and the site he suggests), to make a decision after looking into it with an eye on what fits your situation best. If you're not sure, though, don't make a decision on what might seem right.  It's rare to find two places with identical problems that fit the same pre-made solution, so look at everything available, before making a decision. Good luck, and kudos for asking for advice before jumping in.

                    I wanna be a eunuchs developer! Pass me a bread knife!

                    pkfoxP Offline
                    pkfoxP Offline
                    pkfox
                    wrote on last edited by
                    #10

                    Thanks very much

                    "We can't stop here - this is bat country" - Hunter S Thompson - RIP

                    1 Reply Last reply
                    0
                    • L Lost User

                      I do similar and yes I use VPN for it. From my point of view an easy way and especially a very secure way.

                      It does not solve my Problem, but it answers my question

                      pkfoxP Offline
                      pkfoxP Offline
                      pkfox
                      wrote on last edited by
                      #11

                      Which VPN do you use ?

                      "We can't stop here - this is bat country" - Hunter S Thompson - RIP

                      L 1 Reply Last reply
                      0
                      • pkfoxP pkfox

                        Which VPN do you use ?

                        "We can't stop here - this is bat country" - Hunter S Thompson - RIP

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #12

                        It's a commercial one from F5 (F5 Networks | Secure application delivery[^])

                        It does not solve my Problem, but it answers my question

                        1 Reply Last reply
                        0
                        • pkfoxP pkfox

                          Hi all, I need to remotely access my home Linux hosted Postgresql database remotely - I'm thinking maybe a VPN is the way to go but thought I'd ask you lot first

                          "We can't stop here - this is bat country" - Hunter S Thompson - RIP

                          C Offline
                          C Offline
                          CCostaT
                          wrote on last edited by
                          #13

                          I use a reverse SSH connection. This will open a port on your local machine and tunnel it to your postgresql box. It's especially usefull when developing because you can always connect to localhost:5432 on your local machine instead of having to deal with connection strings and everything else. You don't even need to supply the login credentials to your server. It's way simpler then setting up a VPN and you still get all the security benefits (encryption, etc). There is also another (way cooler IMO) benefit. Bind the postgresql server to localhost:5432 and no one can connect to it, even from inside your lan but this might not e usefull to your case. IMO this makes it even more secure then just using a VPN.

                          pkfoxP 1 Reply Last reply
                          0
                          • C CCostaT

                            I use a reverse SSH connection. This will open a port on your local machine and tunnel it to your postgresql box. It's especially usefull when developing because you can always connect to localhost:5432 on your local machine instead of having to deal with connection strings and everything else. You don't even need to supply the login credentials to your server. It's way simpler then setting up a VPN and you still get all the security benefits (encryption, etc). There is also another (way cooler IMO) benefit. Bind the postgresql server to localhost:5432 and no one can connect to it, even from inside your lan but this might not e usefull to your case. IMO this makes it even more secure then just using a VPN.

                            pkfoxP Offline
                            pkfoxP Offline
                            pkfox
                            wrote on last edited by
                            #14

                            Hi there, sounds interesting how would that work connecting from a remote windows box to a remote ( my home server ) Linux server ? Essentially what I'm trying to achieve is, I'm in the process of writing a Winforms app that connects to a Postgresql database at my home, but I would like to be able to use/develop the app on my Windows Laptop/Tablet when I'm not at home - thanks again for your time

                            "We can't stop here - this is bat country" - Hunter S Thompson - RIP

                            C 1 Reply Last reply
                            0
                            • pkfoxP pkfox

                              Hi there, sounds interesting how would that work connecting from a remote windows box to a remote ( my home server ) Linux server ? Essentially what I'm trying to achieve is, I'm in the process of writing a Winforms app that connects to a Postgresql database at my home, but I would like to be able to use/develop the app on my Windows Laptop/Tablet when I'm not at home - thanks again for your time

                              "We can't stop here - this is bat country" - Hunter S Thompson - RIP

                              C Offline
                              C Offline
                              CCostaT
                              wrote on last edited by
                              #15

                              Hi! In that case you have 2 options. The one I use is to configure your router to portforward an external port (say port 12345) to port 22 to you linux server. Then just use PuTTY on windows (or JuiceSSH on Android. I use both) to connect to :12345 as a reverse proxy. PuTTY, in turn, will open local port 5432 on your windows laptop/home computer. If you don't want or can't use portforward (e.g. the external IP of your router changes a lot), you have a second option. You can use something like SSHReach.me[^] . It works the same way but it's easier to setup. Then you just connect to their servers instead of your router. After this is setup, make your WinForms app connect to localhost:5432 and it will work. The beauty of this is that PostgreSQL thinks you are connecting from localhost so you don't need to send your password. I'm not sure if it's easier then setting up a VPN but for programming it provides (IMO) a lot more flexibility and (maybe) security then a VPN. I'll see if I can send you my PuTTY configuration when I get home. If all this is a little confusing (it was for me) take a look at this SO answer: networking - How does reverse SSH tunneling work? - Unix & Linux Stack Exchange[^] .

                              pkfoxP 1 Reply Last reply
                              0
                              • C CCostaT

                                Hi! In that case you have 2 options. The one I use is to configure your router to portforward an external port (say port 12345) to port 22 to you linux server. Then just use PuTTY on windows (or JuiceSSH on Android. I use both) to connect to :12345 as a reverse proxy. PuTTY, in turn, will open local port 5432 on your windows laptop/home computer. If you don't want or can't use portforward (e.g. the external IP of your router changes a lot), you have a second option. You can use something like SSHReach.me[^] . It works the same way but it's easier to setup. Then you just connect to their servers instead of your router. After this is setup, make your WinForms app connect to localhost:5432 and it will work. The beauty of this is that PostgreSQL thinks you are connecting from localhost so you don't need to send your password. I'm not sure if it's easier then setting up a VPN but for programming it provides (IMO) a lot more flexibility and (maybe) security then a VPN. I'll see if I can send you my PuTTY configuration when I get home. If all this is a little confusing (it was for me) take a look at this SO answer: networking - How does reverse SSH tunneling work? - Unix & Linux Stack Exchange[^] .

                                pkfoxP Offline
                                pkfoxP Offline
                                pkfox
                                wrote on last edited by
                                #16

                                Wow that sounds good but how does the app know that Putty has done some magic ?

                                "We can't stop here - this is bat country" - Hunter S Thompson - RIP

                                C 1 Reply Last reply
                                0
                                • pkfoxP pkfox

                                  Wow that sounds good but how does the app know that Putty has done some magic ?

                                  "We can't stop here - this is bat country" - Hunter S Thompson - RIP

                                  C Offline
                                  C Offline
                                  CCostaT
                                  wrote on last edited by
                                  #17

                                  It doesn't. That's the great thing about it. From the app point of view, it's always connecting to a database on your local machine. You don't need to setup environment variables, hardcode credentials in code, etc, etc Here is my PuTTY setup. Create and save a PuTTY session (just to make things easier) and then add the ports you want (replace 127.0.0.1 with the IP address of your server). When you connect to the session, PuTTY will setup everything: https://i.imgur.com/qSX8pW2.png[^] If you want to make everything even easier, generate a ssh key pair. In that case you don't even need to provide a username/password.Just open the session and that's it. BTW, we are talking about databases but this works for any kind o server. As long as it's something listening on a port, you can do this. EDIT: Just realized something. Setp 5 is wrong. After step 4, save the session otherwise you'll need to do this everytime you connect. Then do step 5

                                  pkfoxP 1 Reply Last reply
                                  0
                                  • C CCostaT

                                    It doesn't. That's the great thing about it. From the app point of view, it's always connecting to a database on your local machine. You don't need to setup environment variables, hardcode credentials in code, etc, etc Here is my PuTTY setup. Create and save a PuTTY session (just to make things easier) and then add the ports you want (replace 127.0.0.1 with the IP address of your server). When you connect to the session, PuTTY will setup everything: https://i.imgur.com/qSX8pW2.png[^] If you want to make everything even easier, generate a ssh key pair. In that case you don't even need to provide a username/password.Just open the session and that's it. BTW, we are talking about databases but this works for any kind o server. As long as it's something listening on a port, you can do this. EDIT: Just realized something. Setp 5 is wrong. After step 4, save the session otherwise you'll need to do this everytime you connect. Then do step 5

                                    pkfoxP Offline
                                    pkfoxP Offline
                                    pkfox
                                    wrote on last edited by
                                    #18

                                    Sorry for all the questions but do I need to open the putty connection before I run my app ? Thanks again for your time.

                                    "We can't stop here - this is bat country" - Hunter S Thompson - RIP

                                    C 1 Reply Last reply
                                    0
                                    • pkfoxP pkfox

                                      Sorry for all the questions but do I need to open the putty connection before I run my app ? Thanks again for your time.

                                      "We can't stop here - this is bat country" - Hunter S Thompson - RIP

                                      C Offline
                                      C Offline
                                      CCostaT
                                      wrote on last edited by
                                      #19

                                      Ahah don't worry. I'm more than happy to help wherever I can :) Answering your question, yes you do need to open the putty connection before running your app otherwise it will not be able to connect to the database. You only need to do this once (when you turn on your PC for example) and then leave it open.

                                      pkfoxP 1 Reply Last reply
                                      0
                                      • C CCostaT

                                        Ahah don't worry. I'm more than happy to help wherever I can :) Answering your question, yes you do need to open the putty connection before running your app otherwise it will not be able to connect to the database. You only need to do this once (when you turn on your PC for example) and then leave it open.

                                        pkfoxP Offline
                                        pkfoxP Offline
                                        pkfox
                                        wrote on last edited by
                                        #20

                                        Hi there, I'm unsure about what I need to port forward in my router and Putty, I see in your screenshot you have 127.0.0.1:5432 ; does that mean I need to port forward 5432 in my router to my database server ? and also put my public ip address in the host text box in Putty ? sorry for all the questions but I've not worked with tunneling before :-D Edit I think I've done it though maybe not the way you suggested :-D - this is what I've done Forwarded port 22 in my router to my local Linux box Forwarded a port xxx in my Putty connection to my local Linux box Changed the port number in my connection string to xxx It worked !!! I'm amazed - thanks for all your help

                                        "We can't stop here - this is bat country" - Hunter S Thompson - RIP

                                        C 1 Reply Last reply
                                        0
                                        • pkfoxP pkfox

                                          Hi there, I'm unsure about what I need to port forward in my router and Putty, I see in your screenshot you have 127.0.0.1:5432 ; does that mean I need to port forward 5432 in my router to my database server ? and also put my public ip address in the host text box in Putty ? sorry for all the questions but I've not worked with tunneling before :-D Edit I think I've done it though maybe not the way you suggested :-D - this is what I've done Forwarded port 22 in my router to my local Linux box Forwarded a port xxx in my Putty connection to my local Linux box Changed the port number in my connection string to xxx It worked !!! I'm amazed - thanks for all your help

                                          "We can't stop here - this is bat country" - Hunter S Thompson - RIP

                                          C Offline
                                          C Offline
                                          CCostaT
                                          wrote on last edited by
                                          #21

                                          Hi, sorry for taking so long to reply (looong weekend..). If I understand correctly then yes, that setup should work both locally on your network as well as remotely :) I should probably make a guide on how to set this up because with all the forwarding going on it gets really confusing really fast. Anyway let me know if you have any more trouble :) And if you want to make everything a little bit more secure, checkout how to connect using a key pair instead of a username/password

                                          pkfoxP 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups