Lua
Lua
SFTP SymLink - Create Symbolic Link on Server
See more SFTP Examples
Demonstrates how to create a symbolic link on the SFTP server.Chilkat Lua Downloads
local chilkat = require("chilkat")
-- This example requires the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
local sftp = chilkat.SFtp.new()
-- Pass a domain or IP address..
local success = sftp:connect("my-sftp-server.com", 22)
if success then
success = sftp:authenticate_pw("mySFtpLogin", "mySFtpPassword")
end
if success then
success = sftp:initialize_sftp()
end
if not success then
print(sftp.last_error_text)
return
end
-- Create a symbolic link on the server.
-- We'll create a link in our HOME directory named "sshd_config"
-- which points to the file /etc/ssh/sshd_config.
success = sftp:sym_link("/etc/ssh/sshd_config", "sshd_config")
if not success then
print(sftp.last_error_text)
return
end
print("Successfully created symbolic link.")