Re: Cygwin 3.4.9 - how to install ssh-keygen

2023-11-24 Thread René Berber via Cygwin

On 11/24/2023 5:31 AM, Matthias--- via Cygwin wrote:
[snip]

 * Answered "no" to use StrictMode


OK, this makes the .ssh directory have the wrong permissions.


$ ls -alh $HOME/.ssh
total 4.0K
drwxr-xr-x 1 meyer Kein 0 Nov 24 12:11 .
drwxr-xr-x 1 meyer Kein 0 Nov 24 12:11 ..
-rw-r--r-- 1 meyer Kein 0 Nov 24 12:11 authorized_keys


[snip]

Which permissions the directories and files should have?
What could the reason be that ssh-keygen don't create any key? Looks like it 
wouldn't try it?


Real question is: Does ssh-keygen work with the wrong permissions?

My understanding is no, it refuses to create keys in those directories. 
And later other ssh parts will refuse to use them.


But I might be wrong.  The author of ssh-host-config certainly believed 
that StrictMode was not necessary.

--
R. B.


--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


RE: EXTERNAL SENDER: Re: Cygwin 3.4.9 - how to install ssh-keygen

2023-11-24 Thread Dale Lobb (Sys Admin) via Cygwin
> -Original Message-
> From: Cygwin 
> On Behalf Of Matthias--- via Cygwin
> Sent: Friday, November 24, 2023 5:32 AM
> To: cygwin@cygwin.com
> Subject: EXTERNAL SENDER: Re: Cygwin 3.4.9 - how to install ssh-keygen
>
> Am Montag, dem 20.11.2023 um 17:54 +0100 schrieb mailto:matth...@gmx.li:
> > Dear all,
> >
> > I've installed cygwin 3.4.9-1 in my virtualbox running on Windows 10.
> > After installing defaults plus openssh 9.5p 1-1, I open the Cygwin64-
> Terminal as Administrator and
> > run ssh-host-config.
> >  * Answered "yes" to create the /etc/ssh_config and /etc/sshd_config
> >  * Answered "no" to use StrictMode
> >  * and "yes" to install sshd as a service
> >  * I just press  for the question for "Value of CYGWIN for the 
> > daemon".
> > cygrunsrv -S cygsshd will not start the sshd. The logfile say "no hostkeys 
> > available".
> >
> > Unfortunately  I can't find ssh-keygen in the installable packages.
> > Howto install ssh-keygen or how to create hostkeys?
> >
> > Thanks in advance
> > Matthias
> >
> Hello,
>
> I installed cygwin 3.4.9-1 with all defaults plus openssh 9.5p 1-1 plus rsync
> 3.2.7-1 in my virtualbox running on Windows 10 again.
>
> In /var/log/setup.log I found "can't run /etc/postinstall/openssl.sh: No such 
> file"
> Anyhow, I opened the Cygwin64-Terminal as Administrator and run 
> ssh-host-config
> but no host-keys has been created:
>$ ssh-host-config
>
>*** Info: Generating missing SSH host keys
>*** Info: Creating default /etc/ssh_config file
>*** Info: Creating default /etc/sshd_config file
>
>*** Info: StrictModes is set to 'yes' by default.
>*** Info: This is the recommended setting, but it requires that the POSIX
>*** Info: permissions of the user's home directory, the user's .ssh
>*** Info: directory, and the user's ssh key files are tight so that
>*** Info: only the user has write permissions.
>*** Info: On the other hand, StrictModes don't work well with default
>*** Info: Windows permissions of a home directory mounted with the
>*** Info: 'noacl' option, and they don't work at all if the home
>*** Info: directory is on a FAT or FAT32 partition.
>*** Query: Should StrictModes be used? (yes/no) no
>*** Info: Updating /etc/sshd_config file
>
>*** Query: Do you want to install sshd as a service?
>*** Query: (Say "no" if it is already installed as a service) (yes/no) yes
>*** Query: Enter the value of CYGWIN for the daemon: []
>
>*** Info: The sshd service has been installed under the LocalSystem
>*** Info: account (also known as SYSTEM). To start the service now, call
>*** Info: `net start cygsshd' or `cygrunsrv -S cygsshd'.  Otherwise, it
>*** Info: will start automatically after the next reboot.
>
>*** Info: Host configuration finished. Have fun!
>
>$ ls -alh /etc/ssh*
>-rw-r--r-- 1 SYSTEM Administratoren 1.5K Nov 24 12:02 /etc/ssh_config
>-rw-r--r-- 1 SYSTEM Administratoren 3.1K Nov 24 12:02 /etc/sshd_config
>
> Also running ssh-user-config don't create any keys:
>$ ssh-user-config
>*** Query: Shall I create a SSH2 RSA identity file for you? (yes/no) yes
>*** Info: Generating /home/meyer/.ssh/id_rsa
>*** Query: Do you want to use this identity to login to this machine?
> (yes/no) yes
>*** Info: Adding to /home/meyer/.ssh/authorized_keys
>cat: /home/meyer/.ssh/id_rsa.pub: No such file or directory
>*** Query: Shall I create a SSH2 DSA identity file for you? (yes/no) no
>*** Query: Shall I create a SSH2 ECDSA identity file for you? (yes/no) no
>*** Query: Shall I create a (deprecated) SSH1 RSA identity file for you?
> (yes/no) no
>
>*** Info: Configuration finished. Have fun!
>
>$ ls -alh $HOME/.ssh
>total 4.0K
>drwxr-xr-x 1 meyer Kein 0 Nov 24 12:11 .
>drwxr-xr-x 1 meyer Kein 0 Nov 24 12:11 ..
>-rw-r--r-- 1 meyer Kein 0 Nov 24 12:11 authorized_keys
>
> An indication of an installation/configuration error of ssh-keygen is that 
> also
>/usr/bin/ssh-keygen -vvf /etc/ssh_host_rsa_key -N '' -t rsa
> don't produce any output. Also if it has return value 0. BTW: Windows
> OpenSSH isn't installed on my
> machine.
>
> René Berber wrote that my files have the wrong permissions. But for shure,
> /home and /home/meyer has
> been created during cygwin installation and /home/meyer/.ssh by ssh-user-
> config.
>
> Which permissions the directories and files should have?
> What could the reason be that ssh-keygen don't create any key? Looks like it
> wouldn't try it?
>
> Thanks in advance
> Matthias
>
>

Try this and look to the end.  Is there  perhaps a segmentation fault error?

$ strace ssh-keygen

  I have a VM with Cygwin installed in it, which used to work for all the 
installed
packages.  However, after a recent update, all binaries linked to openssl now
produce silent segmentation faults.  Could be happening to you too.

Best Regards,

Dale



CONFIDENTIALITY NOTICE

Re: Set localisation locale of Windows netstat?

2023-11-24 Thread Andrey Repin via Cygwin
Greetings, Cedric Blancher!

> How can I set the localisation locale of Windows netstat cmd from
> Cygwin? LC_ALL=C does not help, a French or German Windows will use
> French or German language still

Use "chcp 65001" in your .bashrc or an equivalent file.
Many windows console tools will resort to English if they do not recognize
console code page. This includes netsh, netstat and ipconfig.

To make your life easier (i.e. not to type "chcp.com" every time), place a
script named something like "install-chcp-link.dash" in /etc/postinstall/ with
content along the lines of

> #!/bin/dash
>
> [ -f /usr/local/bin/chcp ] || {
>   ln -fsT "$( cygpath -S )/chcp.com" /usr/local/bin/chcp
> }
>
> exit 0

and it will create a link on the next fill setup run.


-- 
With best regards,
Andrey Repin
Friday, November 24, 2023 17:23:31

Sorry for my terrible english...


-- 
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


Re: Cygwin 3.4.9 - how to install ssh-keygen

2023-11-24 Thread Matthias--- via Cygwin
Am Montag, dem 20.11.2023 um 17:54 +0100 schrieb matth...@gmx.li:
> Dear all,
>
> I've installed cygwin 3.4.9-1 in my virtualbox running on Windows 10.
> After installing defaults plus openssh 9.5p 1-1, I open the Cygwin64-Terminal 
> as Administrator and
> run ssh-host-config.
>  * Answered "yes" to create the /etc/ssh_config and /etc/sshd_config
>  * Answered "no" to use StrictMode
>  * and "yes" to install sshd as a service
>  * I just press  for the question for "Value of CYGWIN for the daemon".
> cygrunsrv -S cygsshd will not start the sshd. The logfile say "no hostkeys 
> available".
>
> Unfortunately  I can't find ssh-keygen in the installable packages.
> Howto install ssh-keygen or how to create hostkeys?
>
> Thanks in advance
> Matthias
>
Hello,

I installed cygwin 3.4.9-1 with all defaults plus openssh 9.5p 1-1 plus rsync 
3.2.7-1 in my
virtualbox running on Windows 10 again.

In /var/log/setup.log I found "can't run /etc/postinstall/openssl.sh: No such 
file"
Anyhow, I opened the Cygwin64-Terminal as Administrator and run ssh-host-config 
but no host-keys has
been created:
   $ ssh-host-config

   *** Info: Generating missing SSH host keys
   *** Info: Creating default /etc/ssh_config file
   *** Info: Creating default /etc/sshd_config file

   *** Info: StrictModes is set to 'yes' by default.
   *** Info: This is the recommended setting, but it requires that the POSIX
   *** Info: permissions of the user's home directory, the user's .ssh
   *** Info: directory, and the user's ssh key files are tight so that
   *** Info: only the user has write permissions.
   *** Info: On the other hand, StrictModes don't work well with default
   *** Info: Windows permissions of a home directory mounted with the
   *** Info: 'noacl' option, and they don't work at all if the home
   *** Info: directory is on a FAT or FAT32 partition.
   *** Query: Should StrictModes be used? (yes/no) no
   *** Info: Updating /etc/sshd_config file

   *** Query: Do you want to install sshd as a service?
   *** Query: (Say "no" if it is already installed as a service) (yes/no) yes
   *** Query: Enter the value of CYGWIN for the daemon: []

   *** Info: The sshd service has been installed under the LocalSystem
   *** Info: account (also known as SYSTEM). To start the service now, call
   *** Info: `net start cygsshd' or `cygrunsrv -S cygsshd'.  Otherwise, it
   *** Info: will start automatically after the next reboot.

   *** Info: Host configuration finished. Have fun!

   $ ls -alh /etc/ssh*
   -rw-r--r-- 1 SYSTEM Administratoren 1.5K Nov 24 12:02 /etc/ssh_config
   -rw-r--r-- 1 SYSTEM Administratoren 3.1K Nov 24 12:02 /etc/sshd_config

Also running ssh-user-config don't create any keys:
   $ ssh-user-config
   *** Query: Shall I create a SSH2 RSA identity file for you? (yes/no) yes
   *** Info: Generating /home/meyer/.ssh/id_rsa
   *** Query: Do you want to use this identity to login to this machine? 
(yes/no) yes
   *** Info: Adding to /home/meyer/.ssh/authorized_keys
   cat: /home/meyer/.ssh/id_rsa.pub: No such file or directory
   *** Query: Shall I create a SSH2 DSA identity file for you? (yes/no) no
   *** Query: Shall I create a SSH2 ECDSA identity file for you? (yes/no) no
   *** Query: Shall I create a (deprecated) SSH1 RSA identity file for you? 
(yes/no) no

   *** Info: Configuration finished. Have fun!

   $ ls -alh $HOME/.ssh
   total 4.0K
   drwxr-xr-x 1 meyer Kein 0 Nov 24 12:11 .
   drwxr-xr-x 1 meyer Kein 0 Nov 24 12:11 ..
   -rw-r--r-- 1 meyer Kein 0 Nov 24 12:11 authorized_keys

An indication of an installation/configuration error of ssh-keygen is that also
   /usr/bin/ssh-keygen -vvf /etc/ssh_host_rsa_key -N '' -t rsa
don't produce any output. Also if it has return value 0. BTW: Windows OpenSSH 
isn't installed on my
machine.

René Berber wrote that my files have the wrong permissions. But for shure, 
/home and /home/meyer has
been created during cygwin installation and /home/meyer/.ssh by ssh-user-config.

Which permissions the directories and files should have?
What could the reason be that ssh-keygen don't create any key? Looks like it 
wouldn't try it?

Thanks in advance
Matthias


-- 
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


Re: Cygwin api to punch a hole into a file?

2023-11-24 Thread Corinna Vinschen via Cygwin
On Nov 23 23:36, Cedric Blancher via Cygwin wrote:
> Linux has fallocate(fd, FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE, ...)
> to punch a hole into a file, i.e. deallocate the blocks given and make
> the file a "sparse file".

We don't support the Linux-specific fallocate(2) call, only ftruncate(2)
and posix_fallocate(3).  Patches, as usual, thoughtfully considered.

> But how can I do that with the Cygwin API? Does anyone have an example
> for Cygwin, which is the Win equivalent to Linux fallocate(fd,
> FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE, 1048576, 2097152);?
> 
> I tried with Cygwin 3.5, but the file was not sparse after that.

Do you remember the discussion in August, starting here:
https://cygwin.com/pipermail/cygwin-developers/2023-August/012664.html
especially:
https://cygwin.com/pipermail/cygwin-developers/2023-August/012679.html

So, did you set the sparse mount option per
https://cygwin.com/cygwin-ug-net/using.html#mount-table
?

Also, chattr -S, which is independent from the mount option "sparse":
https://cygwin.com/cygwin-ug-net/chattr.html


Corinna

-- 
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple