Documentation
¶
Index ¶
- Constants
- func AgentAuth() ssh.AuthMethod
- func Exists(client *sftp.Client, path string) (bool, error)
- func GetGID(info os.FileInfo) uint32
- func GetUID(info os.FileInfo) uint32
- func HasOsAttrib(info os.FileInfo, permission uint32) bool
- func IsReadable(client *sftp.Client, path string) bool
- func LocalAgent() (net.Conn, error)
- func Pull(client *sftp.Client, remote string, local string) (int64, error)
- func Push(client *sftp.Client, local string, remote string) (int64, error)
- func SFTPClient(sshClient *ssh.Client) (*sftp.Client, error)
- func SSHClient(sshCfg *ssh.ClientConfig, addr string) (*ssh.Client, error)
- func SSHConfig(username string, auths []ssh.AuthMethod) *ssh.ClientConfig
- func StopCli(tunnel *SSHTunnel) error
- type Endpoint
- type SSHTunnel
Constants ¶
View Source
const ( OsRead = 04 OsWrite = 02 OsEx = 01 OsUserShift = 6 OsGroupShift = 3 OsOthShift = 0 OsUserR = OsRead << OsUserShift OsUserW = OsWrite << OsUserShift OsUserX = OsEx << OsUserShift OsUserRw = OsUserR | OsUserW OsUserRwx = OsUserRw | OsUserX OsGroupR = OsRead << OsGroupShift OsGroupW = OsWrite << OsGroupShift OsGroupX = OsEx << OsGroupShift OsGroupRw = OsGroupR | OsGroupW OsGroupRwx = OsGroupRw | OsGroupX OsOthR = OsRead << OsOthShift OsOthW = OsWrite << OsOthShift OsOthX = OsEx << OsOthShift OsOthRw = OsOthR | OsOthW OsOthRwx = OsOthRw | OsOthX OsAllR = OsUserR | OsGroupR | OsOthR OsAllW = OsUserW | OsGroupW | OsOthW OsAllX = OsUserX | OsGroupX | OsOthX OsAllRw = OsAllR | OsAllW OsAllRwx = OsAllRw | OsGroupX )
File permission attributes (linux)
Variables ¶
This section is empty.
Functions ¶
func AgentAuth ¶
func AgentAuth() ssh.AuthMethod
AgentAuth returns a ssh.AuthMethod to use your local authentication agent
func HasOsAttrib ¶
HasOsAttrib checks if given os.FileInfo matches given permissions:
Use OS_ constants to define the permissions flag:
if sshkit.HasOsAttrib(info, sshkit.OsUserR) { // This file is readable for user }
if !sshkit.HasOsAttrib(info, sshkit.OsGroupW) { // This file is NOT writable for group members }
func IsReadable ¶
IsReadable checks if a given file on the remote server is readable
func LocalAgent ¶
LocalAgent returns a connection to the local authentication agent via auth sock env variable
func SFTPClient ¶
SFTPClient returns a client to handle any SFTP actions
func SSHConfig ¶
func SSHConfig(username string, auths []ssh.AuthMethod) *ssh.ClientConfig
SSHConfig returns a ssh.ClientConfig for given parameters
Types ¶
Click to show internal directories.
Click to hide internal directories.