Showing posts with label Systems Administration. Show all posts
Showing posts with label Systems Administration. Show all posts

2018-01-04

Cygwin: Permissions 0660 for '~/.ssh/id_rsa' are too open.

Environment:

  • MS Windows 8.1
  • Cygwin 64bit
  • ssh keys copied from somewhere and placed to ~/.ssh/

Problem:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0660 for '~/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: ~/.ssh/id_rsa

Did not work:

  • chmod 600 id_rsa
  • chmod 700 .ssh
  • Playing with Windows security panels
  • Setting group to SYSTEM
  • Everything else

Solution:

Found on Vineet Gupta's blog http://vineetgupta.com/blog/cygwin-permissions-bug-on-windows-8

chgrp Users id_rsa
chmod 600 id_rsa

Now, all works. Thank you, Vineet!

2017-01-15

Cannot disconnect USB drive? Close the Task Manager!

Excuses
Yes, I am still using a WD "Passport" for downloaded movies. Copy on PC and connect the drive to TV's port. Yes, I know that I can stream. Yes, I have a good router. Never mind :-)
Oh, yes, I am still using Windows. Dear Mac users, I love you, too, but not as much as I love Bill Gates :)

<jokes aside>

Problem
"Windows cannot disconnect your USB drive". Close the programs, blah-blah-blah.

Obvious
Well, closing File Manager's windows surely helps.
Waiting a bit after the file is "copied" helps, too. I guess, some portions of it are not flushed to the drive yet (who knows, it's Windows).

Who cares?
My TV. Sometimes. Just does not see the files if the drive wasn't properly dismounted.

Not so obvious
The TASK MANAGER!
I believe, it monitors the disk activity. So, shut it down.

Not obvious at all
Atlassian's SourceTree.
Why? Who knows. I do not want to know. These days, I am using PHPStorm's Git or a command line. SourceTree is kept for some strange cases when I am not 100% sure what I just did... :-)

</off to watch>

2016-07-14

Cygwin and ANSI terminal

Problem

I see ANSI color sequences on Cygwin.

Explanation

The default Cygwin.bat runs bash in a Window terminal, which does not support ANSI sequences, so you'll see the color codes instead of actual colors:

$ codecept selfupdate

[37;41m                                                                   [39;49m
[37;41m  [Symfony\Component\Console\Exception\CommandNotFoundException]   [39;49m

Solution

Edit the Cygwin.bat and make it look like:

@echo off

C:
chdir C:\cygwin64\bin

mintty -

Now, it will run "mintty", which is a different terminal, and it will show the colors correctly.
(Be prepared for the possible changes in copy/paste with mouse clicks).

2015-10-16

WordPress security : disallow author query

Friday afternoon. Looking at the access log... here are some "nice" requests. Happened at the same millisecond, and look very "hack-ish" to me.

54.80.2.64 - - [16/Oct/2015:18:46:25 +0000] "HEAD /?author=5 HTTP/1.1" 404 159 "-" "-"
54.80.2.64 - - [16/Oct/2015:18:46:25 +0000] "HEAD /?author=1 HTTP/1.1" 404 159 "-" "-"
54.80.2.64 - - [16/Oct/2015:18:46:25 +0000] "HEAD /?author=3 HTTP/1.1" 404 159 "-" "-"
54.80.2.64 - - [16/Oct/2015:18:46:25 +0000] "HEAD /?author=2 HTTP/1.1" 404 159 "-" "-"
54.80.2.64 - - [16/Oct/2015:18:46:25 +0000] "HEAD /?author=4 HTTP/1.1" 404 159 "-" "-"


Well, they all resulted in 404 Page not found...

...because I have this in .htaccess:

# - Do not allow author query to avoid real names exposure
RewriteCond %{QUERY_STRING} ^author=\d+
RewriteRule ^ - [R=404,L]

It's that simple. :)

2014-01-24

Sender address rejected: Domain not found - outgoing mail settings with Postfix

Environment:

A staging server called "tst.myserver.com", with no DNS record pointing to it.
Trying to send email from there to myself (me@my-mail.com)

Problem:

$ echo foo | mail -s bar me@my-mail.com
$ tail /var/log/mail.log
Jan 24 18:30:24 tst postfix/smtp[26306]: 46D8FC2584: to=<me@my-mail>, relay=mail.my-mail[1.2.3.4]:25, delay=0.61, delays=0.02/0.01/0.45/0.13, dsn=5.1.8, status=bounced (host my-mail[1.2.3.4] said: 554 5.1.8 <me@tst.myserver.com>: Sender address rejected: Domain not found (in reply to RCPT TO command))

Explanation:

$ cat /etc/hostname
tst.myserver.com
This is the FQDN (fully qualified domain name), and Postfix appends it to the local user name.

What we want

We'd like Postfix to append only the myserver.com and not the tst.myserver.com

A solution

(figured out by reading http://www.postfix.org/ADDRESS_REWRITING_README.html)
# vi /etc/postfix/main.cf
(add this line:)
masquerade_domains = myserver.com
Restart Postfix
# postfix stop && postfix start

2014-01-04

Could not open input file: /cygdrive/c/PHP/phpunit (PHP under Cygwin)

The problem:

$ /cygdrive/c/PHP/php.exe /cygdrive/c/PHP/phpunit
Could not open input file: /cygdrive/c/PHP/phpunit

Environment:

MS Windows
PHP
Cygwin

Explanation:

While started in Cygwin, php.exe will be run in Windows environment, which does not know how to translate /cygdrive/c to C:\

Solution:

Use a wrapper script https://gist.github.com/tivnet/8256140
(Originally published by aefxx here)