Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH Port #36

Closed
hendreychikane opened this issue Aug 30, 2018 · 3 comments
Closed

SSH Port #36

hendreychikane opened this issue Aug 30, 2018 · 3 comments

Comments

@hendreychikane
Copy link

I tried looking for a settings to change the default sshd port from 22 to something else with no luck, where can this be changed?

@Aidaho12
Copy link
Member

Aidaho12 commented Aug 31, 2018 via email

@hendreychikane
Copy link
Author

Thanks, solved it, check this out.

def ssh_connect(serv, **kwargs):
	import sql
	fullpath = get_config_var('main', 'fullpath')
	for sshs in sql.select_ssh(serv=serv):
		ssh_enable = sshs[3]
		ssh_user_name = sshs[4]
		ssh_user_password = sshs[5]
		ssh_key_name = fullpath+'/keys/%s.pem' % sshs[2]
	ssh_port = XXXX
	ssh = SSHClient()
	ssh.load_system_host_keys()
	ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
	try:
		if ssh_enable == 1:
			k = paramiko.RSAKey.from_private_key_file(ssh_key_name)
			ssh.connect(hostname = serv, port = ssh_port, username = ssh_user_name, pkey = k )
		else:
			ssh.connect(hostname = serv,  port = ssh_port,  username = ssh_user_name, password = ssh_user_password)
		if kwargs.get('check'):
			return True
		else:
			return ssh

@Aidaho12
Copy link
Member

Aidaho12 commented Sep 1, 2018

I' m added this too))

@Aidaho12 Aidaho12 closed this as completed Sep 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants