・ I am trying to construct a VPN by borrowing ConoHa server.
-The server side is CentOS and the client side is Ubuntu.
・ I changed this port
Even if you try to connect to SSH with ssh [email protected]
ssh: connect to host 111.222.333.444 port 22: Connection refused
It comes out.
I changed the port to 5195, so I tried to connect with ssh -p 51945 [email protected]
ssh: connect to host 111.222.333.444 port 51945: Connection refused
ssh -p 51945 Connection at [email protected]>impossible
Review port number change settings (details)
I want to change the port from 22, change the contents in vi/etc/sysconfig/iptables
#sample configuration for iptables service
#You can edit this manually or use system-config-firewall
#Please do not ask us to add additional ports/services to this default configuration
: INPUT ACCEPT [0: 0]
: FORWARD ACCEPT [0: 0]
: OUTPUT ACCEPT [0: 0]
-A INPUT -m state --state RELATED, ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 51945 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 5555 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
(# Is half-width.)
I also changed it to 51945 in $sudo vi/etc/ssh/sshd_config.
On the client side
The secret key has already been set up.
Also, the port number is 51945 in vi/etc/ssh/sshd_config.
Please help m (_ _) m
Answer # 1
By the way, from the management screen of Conoha for VPS
Select the instance and open the console to modify the settings.
After changing the settings, you cannot log in as root.If the
Log in with the created user and its password and execute sudo command
The procedure is to obtain administrator privileges.
To prevent external attacks trying to log in as root
I log in as a user other than root.
.ssh/config setting is valid, connect with the host name, IP, and port described.
For example, enter
ssh conohaand the command, and only enter the password when creating the ssh key
You can log in. develop If you are asked for your password,
There is a high possibility that the private key public key is not set correctly.
If you specify the IP directly with the ssh command, it will look like the following example
ssh -p 51945 -i ~/.ssh/hoge_rsa [email protected]
I checked the site that was listed for reference and tried the procedure.
systemctl restart sshd
systemctl restart iptbles
After performing the above,
ssh conohaconfirmed the connection after changing the port.
Please note that
RSAAuthentication is not required for recent versions
Since other items have already been described, please correct them by removing the comments instead of adding them.
2. The permissions and names of the private key and public key are set correctly
3. The port number set with sshd after the change matches the port number opened with iptables
4. Work while understanding the meaning of the steps being performed (if you don't understand)
Retry the server from the rebuild, and check whether ssh connection is possible each time.
I think there is an error somewhere in the procedure.
Answer # 2
How about the hosts file?
hosts.deny and hosts.allow
Answer # 3
Are both sshd and iptables restarted?
Answer # 4
Because editing is progressing with iptables, I think that it is probably already confirmed
- centos - ssh connection with teraterm is not possible
- cannot connect http after installing httpd on centos 7
- Centos example of modifying ssh default port number
- Summary of mysql maximum connection number setting skills
- php - i want to send data by post immediately after changing the value of the select box
- laravel 5 - mysql connection error after clearing laravel cache
- ruby - can't save after changing column in production environment
- can't use ping etc when bridge connection of centos7 and fixed ip address?
- linux - i can't stop journalctl logging after changing the log level
- dns - after changing the domain name server acquired by mumu domain to route53, where should the mail server be used?
- html - even after changing the value of selected in the select box after locationreload, that part is not specified
- github - cannot change git add after changing local repository storage location
- centos - yum now gives an error after deleting the cache
- ruby on rails - if you destroy after changing the date with ajax, the previous data will be erased
- php - after changing the apache root directory, my laravel app stopped working
- ruby on rails - with ruby on rails, after changing the name of the database column, i can no longer create and update
- i can't omit the sh command after changing the mac shell from bash to zsh
- after changing the mysql authentication plugin, i can no longer log in
- python - after changing the installation destination of mecab, it stopped working
- ruby on rails - in rails6, after changing from bootstrap3 to 4, i can no longer @import "bootstrap" in scss file
- failed to connect to postgresql (db server)
- Raspberry Pi 4b Ubuntu19 server installation docker-ce installation steps
- In-depth analysis of the Tomcat server of Centos 7 system
- Install zip and unzip instruction functions (server) under Linux and CentOS
- centos7 server basic security setup steps
- Samba server configuration under Centos7 (combat)
- Tutorial on setting up an FTP server in Ubuntu 1604
- Example of how to install and configure Postfix mail server on CentOS8
- Tutorial to install Nginx-RTMP streaming server on Ubuntu 14
- Method for setting up mysql master-slave server on centos7