Code: Alles auswählen
/usr/bin/ssh $USERNAME@$HOSTNAME << EOF
EOF
Code: Alles auswählen
/usr/bin/ssh $USERNAME@$HOSTNAME << EOT
EOT
Code: Alles auswählen
/usr/bin/ssh $USERNAME@$HOSTNAME << EOF
EOF
Code: Alles auswählen
/usr/bin/ssh $USERNAME@$HOSTNAME << EOT
EOT
Code: Alles auswählen
ssh root:xxx@hostname
also lieber unsichere Server betreiben?jmar83 hat geschrieben:15.01.2020 11:13:22und kann auch nicht stundenlang irgendwelche Dokumentationen "durchackern" - na ja.
Code: Alles auswählen
lftp -p 22 -u $REMOTE_USERNAME,$REMOTE_PASSWORD sftp://$REMOTE_SERVER << EOF
# Set connection parameters {
set sftp:auto-confirm yes;
set ssl:verify-certificate no;
set net:timeout 3;
set ftp:passive-mode true;
set ftp:use-mode-z true;
set ftp:mode-z-level 9;
set ftp:use-allo true;
# } Set connection parameters
# Upload locally saved, self-generated certificates for other clients {
mirror -R --allow-chown /etc/mysql/client_cert /etc/mysql;
# } Upload locally saved, self-generated certificates for other clients
# Remove locally saved, self-generated certificates for other clients {
!rm -f /etc/mysql/client_cert/*;
# } Remove locally saved, self-generated certificates for other clients
# Set remote permissions {
chmod 0400 /etc/mysql/client-cert.pem;
chmod 0400 /etc/mysql/client-key.pem;
chmod 0400 /etc/mysql/client-key-pkcs8.pem;
chmod 0400 /etc/mysql/client-req.pem;
# } Set remote permissions
# Close SFTP connection after upload {
quit;
# } # Close SFTP connection after upload
EOF
# Set remote files owner with SSH, 'lftp' is not able to do a remote chown {
php /etc/mysql/changeperm.php -h $REMOTE_SERVER -u $REMOTE_USERNAME -p $REMOTE_PASSWORD
# } Set remote files owner with SSH, 'lftp' is not able to do a remote chown
Code: Alles auswählen
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$options = getopt("h:u:p:");
if(!isset($options['h']) || !isset($options['u']) || !isset($options['p']))
{
echo "\r\n";
echo "You need to set these parameters: " . "\r\n";
echo " Hostname: -h ... " . "\r\n";
echo " Username: -u ... " . "\r\n";
echo " Password: -p ... " . "\r\n";
echo "\r\n\r\n";
exit;
}
$options['h'] = trim($options['h']);
$options['u'] = trim( $options['u']);
$options['p'] = trim($options['p']);
set_include_path('/etc/mysql/phpseclib1.0.18');
require "Net/SSH2.php";
$ssh = new Net_SSH2($options['h']);
if (!$ssh->login($options['u'], $options['p'])) {
exit("\r\n" . 'Login failed, wrong hostname and/or user credentials. Please try again.' . "\r\n\r\n");
}
$ssh->exec("chown mysql:mysql /etc/mysql/*.pem");
?>
Dazu ein Zitat aus der lftp-manpage:jmar83 hat geschrieben:15.01.2020 17:39:50Ja, wenn ich gewusst hätte dass das "doofe" lftp remote kein chown kann...
Code: Alles auswählen
Commands
[...]
chmod mode files
Change permission mask on remote files. The mode must be an octal number.
Code: Alles auswählen
[b]"Remote chown is not implemented, mirror can only chown local files."[/b]
Na und. In dem von dir verlinkten Thread steht:jmar83 hat geschrieben:15.01.2020 19:01:15Ach - es geht ja gar nicht um `chmod`, sondern `chown` !!! Sorry dass ich das zuerst falsch geschrieben habe!!!!
Es gehen also weder chown noch chmod.Remote chown is not implemented, mirror can only chown local files.
Code: Alles auswählen
lftp -p 22 -u $REMOTE_USERNAME,$REMOTE_PASSWORD sftp://$REMOTE_SERVER << EOF
# Set connection parameters {
set sftp:auto-confirm yes;
set ssl:verify-certificate no;
set net:timeout 3;
set ftp:passive-mode true;
set ftp:use-mode-z true;
set ftp:mode-z-level 9;
set ftp:use-allo true;
# } Set connection parameters
# Upload locally saved, self-generated certificates for other clients {
mirror -R --allow-chown /etc/mysql/client_cert /etc/mysql;
# } Upload locally saved, self-generated certificates for other clients
# Remove locally saved, self-generated certificates for other clients {
!rm -f /etc/mysql/client_cert/*;
# } Remove locally saved, self-generated certificates for other clients
# Set remote permissions {
chmod 0400 /etc/mysql/client-cert.pem;
chmod 0400 /etc/mysql/client-key.pem;
chmod 0400 /etc/mysql/client-key-pkcs8.pem;
chmod 0400 /etc/mysql/client-req.pem;
# } Set remote permissions
# Close SFTP connection after upload {
quit;
# } # Close SFTP connection after upload
EOF