Help us understand the problem. What is going on with this article?

MACのファイル属性(パーミッション)に付与される「@」を削除する

More than 1 year has passed since last update.

環境:MacBookPro MacOS HighSierra ver10.13.6
AWS構築時にSSH用の.pemのファイルをダウンロードしたところ、ファイルのパーミッションの最後に@が付いていました。

[hoge:~/.ssh/authorized_key $ ls -la
total 56
drwxr-xr-x  9 hoge  CLARAONLINE\Domain Users   288 Aug 28 16:07 .
drwx------  8 hoge  CLARAONLINE\Domain Users   256 Aug 29 13:57 ..
-r--------@ 1 hoge  CLARAONLINE\Domain Users  1692 Aug 28 11:08 clara-test02.pem
-rw-------@ 1 hoge  CLARAONLINE\Domain Users  1688 Aug 28 16:06 clara-test03.pem
-rw-------  1 hoge  CLARAONLINE\Domain Users  1671 Aug 14 15:45 id_rsa_clara-test02.pem

これはMACの拡張属性(EA:Extended Attributes)のようで、詳細はls -l@で確認できます。

[hoge:~/.ssh/authorized_key $ ls -l@ clara-test02.pem
-r--------@ 1 hoge  CLARAONLINE\Domain Users  1692 Aug 28 11:08 clara-test02.pem
        com.apple.metadata:kMDItemWhereFroms     217
        com.apple.quarantine      57

2つappleの属性がついているのでxattrコマンドで削除します。

[hoge:~/.ssh/authorized_key $ sudo  xattr -d com.apple.metadata:kMDItemWhereFroms clara-test02.pem
[hoge:~/.ssh/authorized_key $ sudo  xattr -d com.apple.quarantine clara-test02.pem

「@」が消えました。

[hoge:~/.ssh/authorized_key $ ls -l;a
total 56
-r--------  1 hoge  CLARAONLINE\Domain Users  1692 Aug 28 11:08 clara-test02.pem
-rw-------@ 1 hoge  CLARAONLINE\Domain Users  1688 Aug 28 16:06 clara-test03.pem

directry指定の場合はこちらで一括削除ができるみたいです。

% xattr -cr <directory>

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした