You could have skilled the scenario that an skilled workforce member, geared up with a lot of configured WinSCP websites, wish to share this info with a beginner workforce member (and all future newbies). A easy export & import won’t suffice, for the reason that configuration comprises personalised authentication knowledge (usernames and passwords, or keyfile places). And also you don’t wish to power the beginner to manually copy-and-paste connection knowledge and his personal authentication knowledge right into a sequence of recent WinSCP websites, as this might be inefficient, tedious, and error-prone.
Here’s a fast overview of the answer to this downside. Particulars might be given within the sections under.
Export and de-customization of the present configuration:
- Group websites with equivalent authentication knowledge into WinSCP folders
- Export the configuration into an
inifile utilizing the suitable WinSCP dialog
- De-customize this configuration by way of command line (reset credentials & working directories)
- Do some clean-up on the
inifile (historical past)
- Share the
inifile with the beginner (e.g., by committing it to your workforce’s SCM)
Customization and import of this configuration:
- Retrieve the
- Customise this configuration by way of command line (set credentials & working directories)
- Launch WinSCP with this configuration
When utilizing a central LDAP server for authentication, most of your logins would require the identical credentials. On the identical time, there may be logins with particular credentials (resembling read-only “view” customers for sure check servers) that don’t require customization, and that shall be left untouched. To permit the beginner to customise the fitting websites with a single batch script, it’s a must to group them utilizing WinSCP folders. This may be accomplished inside WinSCP by selecting
Handle > New Folder:
Right here is an easy instance how your WinSCP structure would possibly appear like:
This scheme will be simply prolonged to cowl a number of private customers, and mixed with sub-folders for managing totally different tasks.
Export the configuration by selecting
Instruments > Export/Backup Configuration inside WinSCP:
On this step, you overwrite personalised knowledge from the exported configuration with generic default values:
- person names
- key file places
- working directories
That is accomplished by executing the next script:
@echo off REM configuration settings used under set YOUR_INI="demo.ini" set YOUR_LDAP_USER="ldapuser" set YOUR_WINDOWS_USER="winuser" set YOUR_PRIVATE_KEY="C:UsersYouprivatekey.ppk" set WINSCP_DIR="C:Program Recordsdata (x86)WinSCP" REM adapt login credentials %WINSCP_DIRpercentWinSCP.com ^ /ini=%YOUR_INI% ^ /batchsettings ^ "Private Consumer"/* ^ UserName=%YOUR_LDAP_USER% ^ TunnelUserName=%YOUR_LDAP_USER% ^ PublicKeyFile=%YOUR_PRIVATE_KEY% ^ TunnelPublicKeyFile=%YOUR_PRIVATE_KEY%" REM adapt working directories %WINSCP_DIRpercentWinSCP.com ^ /ini=%YOUR_INI% ^ /batchsettings ^ */* ^ LocalDirectory="C:UserspercentYOUR_WINDOWS_USER%" ^ RemoteDirectory=/
So what is occurring right here?
/inisupplies the situation of your exported
/batchsettingspermits mass-modification of saved websites
*/*match the location configurations inside the present folders
TunnelPublicKeyFilepresent the situation of your personal SSH key file
RemoteDirectorypresent the directories which might be opened by WinSCP after login
Observe that we use
WinSCP.com as a substitute of
WinSCP.exe for scripting.
If you’re working with passwords as a substitute of key recordsdata, it’s a must to present the
PasswordPlain parameter to reset your passwords. Nonetheless, this solely works in case you first disable your WinSCP grasp password, so watch out when doing this.
ini file comprises a number of strains of utilization historical past that you could simply clear up with a textual content editor. Merely seek for the next part headers, and delete the strains under:
To just remember to didn’t miss something, you possibly can manually double-check the values saved within the config file, and seek for your person title and the string
Launching with a particular config
ini file will be offered as a command-line parameter to WinSCP:
This fashion, you may also set up your websites into a number of recordsdata, and create acceptable shortcuts for on-demand use.
WinSCP model used for this text: 5.17