Score:1

How to ssh into a remote computer

in flag

I have two laptops, one running Ubuntu (server) and another running Debian (client), and I want to use ssh to log in to the shh server. While on my router's network, using the private IP address of the server works fine. However, as soon as I leave the network (client), such as connecting to my phone's hotspot or using some other network with internet access, I can no longer connect, using either the public or private IP. The service being used to connect is openssh.

cn flag
We do not support debian. If you want questions regarding the CLIENT side and "However, as soon as I leave the network, such as connecting to my phone's hotspot or using some other network with internet access" I would assume to be from the client then please use https://unix.stackexchange.com/ for your question.
Nmath avatar
ng flag
I'm your assuming the server laptop is on your home network. You can't ssh into a server on your home network unless you're either on your home network or you have a dedicated IP address or dynamic DNS from your ISP and you expose your home network to the internet. Don't expose your home network this way unless you are absolutely confident in your ability to secure your network. Even for someone who is not a novice, it's not a very good idea. Instead consider renting a server or a VPS.
puma avatar
in flag
@Nmath is a home network, I aimed to be able to remote access files from the server, Is there a better and/or safer solution than ssh, and couldn't I just expose port 23, or use a VPN?
ar flag
Does this answer your question? [Connect two computers with SSH in a home LAN](https://askubuntu.com/questions/1107987/connect-two-computers-with-ssh-in-a-home-lan)
FedKad avatar
cn flag
First make sure that your ISP does not put you behind CGNAT or whether you can use IPv6.
puma avatar
in flag
@user68186 I can access the computer fine on LAN, its remote access that is my issue.
user535733 avatar
cn flag
When you could connect properly on the LAN, you conclusively demonstrated that your Ubuntu server is properly configured and operating. After that, your problem is getting through your router, which has nothing to do with Ubuntu. Look up how to use the *port forwarding* feature on your router.
ar flag
Remote access issues are not Ubuntu related problems. These can be due to your ISP's settings that you can't change, as well as your router settings which you can change. However, your router settings are off-topic here.
puma avatar
in flag
@user68186 thanks, I'll go look at a networking StackExchange
ar flag
Also see the **When Traveling** section of [this answer](https://askubuntu.com/questions/1267872/remote-desktop-access-between-2-ubuntu-20-04-devices-over-the-internet/1267978#1267978) for some hints on port forwarding and DDNS.
Nmath avatar
ng flag
ssh itself is safe, but opening up your home network is not so safe. Depending on what services you need to access remotely, it might be a better idea to get a VPS or dedicated server hosting
Score:2
cn flag
raj

By design, if you have a LAN behind a NAT router, it is not possible to connect from outside to inside your LAN. Private addresses have no meaning outside your LAN (that's why they are called "private") and using the public address, you will connect to your router only and not to any machine inside your LAN. As @user535733 has pointed out, you need to set up port forwarding on your router so that the router knows that connections to a particular port (say, ssh port) on the router should be forwarded to a particular machine inside your LAN. This has nothing to do with Ubuntu or Debian itself and you have to check your router's documentation on how to do that.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.