跳到主內容

【extension】sftp

 

產生Config

vscode 按下 Ctrl + Shift + P

輸入 SFTP:Config


 

image-1638770235855.png

Config 相關


單一來源

[
  {
    "name": "demo_10.1.1.1",
    "context": "D:\\php_workspace\\demo",
    "host": "10.1.1.1",
    "username": "user1",
    "password": "12345678",
    "remotePath": "/root"
	}
]

多個來源

[
  {
    "name": "demo_10.1.1.1",
    "context": "D:\\php_workspace\\demo\web1",
    "host": "10.1.1.1",
    "username": "user1",
    "password": "12345678",
    "remotePath": "/root"
	},
     {
    "name": "demo_10.1.1.2",
    "context": "D:\\php_workspace\\demo\web2",
    "host": "10.1.1.2",
    "username": "user1",
    "password": "12345678",
    "remotePath": "/root"
	},
]

使用跳板機(帳號密碼)

[
{
    "name": "jump_demo",
    "remotePath": "/root",
    "context": "D:\\php_workspace\\jump_demo",
    
    "host": "10.1.1.1", 	// 跳板機ip
    "username": "user1",	// 跳板機 帳號
    "password": "12345678", // 跳板機 密碼
    
    "hop": {
        "host": "192.168.1.1", // 目的地ip
        "port": 22,
        "username": "target_user",	// 目的地 帳號
        "password": "66778899"		// 目的地 密碼
    },
    // 排除檔案
    "ignore": [
        ".vscode",
        ".git",
        ".DS_Store",
        "**/logs/**",
        "**/sessions/**"
    ],
  	// 儲存後自動上傳
    "uploadOnSave": false
}
]

使用跳板機(憑證)

[
{
    "name": "jump_demo",
    "remotePath": "/root",
    "context": "D:\\php_workspace\\jump_demo",
    
    "host": "10.1.1.1", // 跳板機ip
    "username": "user1",
    "password": "12345678",   
    
    "hop": {
        "host": "192.168.1.1", // 目的地ip
        "port": 22,
        "username": "target_user",
        "privateKeyPath": "/home/user1/.ssh/id_rsa" //使用憑證(跳板機位置)
    },
    // 排除檔案
    "ignore": [
        ".vscode",
        ".git",
        ".DS_Store",
        "**/logs/**",
        "**/sessions/**"
    ],
  	// 儲存後自動上傳
    "uploadOnSave": false
}
]