From 1e97f1e3a7d0facd610c7497689df57ef1f8307c Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Tue, 2 Apr 2019 03:15:53 +0100 Subject: [PATCH] sudo read file --- home.admin/config.scripts/internet.sshtunnel.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/home.admin/config.scripts/internet.sshtunnel.py b/home.admin/config.scripts/internet.sshtunnel.py index dae877c..4e7bc62 100755 --- a/home.admin/config.scripts/internet.sshtunnel.py +++ b/home.admin/config.scripts/internet.sshtunnel.py @@ -107,9 +107,7 @@ if sys.argv[1] == "on": print("DONE") else: print("OK - root id_rsa.pub file exists") - ssh_pubkey="" - with open('/home/root/.ssh/id_rsa.pub', 'r') as file: - ssh_pubkey = file.read().replace('\n', '') + ssh_pubkey = subprocess.check_output("sudo cat /root/.ssh/id_rsa.pub", shell=True, universal_newlines=True) # make sure autossh is installed # https://www.everythingcli.org/ssh-tunnelling-for-fun-and-profit-autossh/