ssh免登录 & sftp 直接修改保存线上机代码

Ssh免登录

1.本地ssh 生成钥匙

2.复制id_rsa.pub中的内容

3.登陆服务器~/.ssh/authorized_keys 中添加

然后本地直接[email protected]

sftp

1.需要sublime有sftp 扩展。

2.与线上代码目录一致

3.与线上代码结构一致

Example.   本地。/my/wf

线上/data1/www/htdocs/wf/

在本地

wf目录右键sftp->Edit Remote Mapping    生成相应的配置文件

并修改

记得给权限

chmod -R 777

保存测试 看是否成功

下面是配置    

其中 

 "host": “47.93.xx.xx",  主机地址

"user": "root",  连接名称   有ssh可以不用密码


{

// The tab key will cycle through the settings when first created

// Visit http://wbond.net/sublime_packages/sftp/settings for help

// sftp, ftp or ftps

"type": "sftp",

"save_before_upload": true,

"upload_on_save": true,

"sync_down_on_open": false,

"sync_skip_deletes": false,

"sync_same_age": true,

"confirm_downloads": false,

"confirm_sync": true,

"confirm_overwrite_newer": false,

"host": “47.93.xx.xx",

"user": "root",

//"password": "password",

//"port": "22",

"remote_path": "/data1/www/htdocs/wf/",

"ignore_regexes": [

"\\.sublime-(project|workspace)", "sftp-config(-alt\\d?)?\\.json",

"sftp-settings\\.json", "/venv/", "\\.svn/", "\\.hg/", "\\.git/",

"\\.bzr", "_darcs", "CVS", "\\.DS_Store", "Thumbs\\.db", "desktop\\.ini"

],

//"file_permissions": "664",

//"dir_permissions": "775",

//"extra_list_connections": 0,

"connect_timeout": 30,

//"keepalive": 120,

//"ftp_passive_mode": true,

//"ftp_obey_passive_host": false,

//"ssh_key_file": "~/.ssh/id_rsa",

//"sftp_flags": ["-F", "/path/to/ssh_config"],

//"preserve_modification_times": false,

//"remote_time_offset_in_hours": 0,

//"remote_encoding": "utf-8",

//"remote_locale": "C",

//"allow_config_upload": false,

}

你可能感兴趣的:(ssh免登录 & sftp 直接修改保存线上机代码)