It seems that when creating directory using this function, permissions are affected by the system umask setting.
If you want to make sure proper permissions are set, after creating directory, set permissions by using ssh2_sftp_chmod function.
(PECL ssh2 >= 0.12)
ssh2_sftp_chmod — Modifica el modo de un fichero
Intenta modificar el modo del fichero especificado, utilizando el
mode
proporcionado.
sftp
Un recurso SSH2 SFTP, abierto con la función ssh2_sftp().
filename
Ruta hacia el fichero.
mode
Permisos sobre el fichero. Ver la función chmod() para más detalles concernientes a este parámetro.
Ejemplo #1 Cambio del modo del fichero en el servidor remoto
<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'nombreUsuario', 'contraseña');
$sftp = ssh2_sftp($connection);
ssh2_sftp_chmod($sftp, '/carpeta/fichero', 0755);
?>
It seems that when creating directory using this function, permissions are affected by the system umask setting.
If you want to make sure proper permissions are set, after creating directory, set permissions by using ssh2_sftp_chmod function.