+ ssh = paramiko.SSHClient()
+ ssh.load_system_host_keys()
+ sshstr, remotepath = config['serverwebroot'].rstrip('/').split(':')
+ if sshstr.find('@') >= 0:
+ username, hostname = sshstr.split('@')
+ else:
+ username = pwd.getpwuid(os.getuid())[0] # get effective uid
+ hostname = sshstr
+ ssh.connect(hostname, username=username)
+ sftp = ssh.open_sftp()
+ if os.path.basename(remotepath) \
+ not in sftp.listdir(os.path.dirname(remotepath)):
+ sftp.mkdir(remotepath, mode=0755)