1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Linux関連 メモまとめ【備忘録】

Posted at

概要

・参考になるものがあまりなく苦労したことをメモ書きでまとめる。

LinuxとWindowsの共有フォルダをマウント

# Linux側のコマンドプロンプトにて実行
$ mount -t cifs -o username={ユーザー名(windows側)},password={パスワード} //{IPアドレス(windows側)}/{ディレクトリ} {ディレクトリ(Linux側)}

上記のコマンドにて、マウントした。
実行にあたってSambaなどの導入などを行った。
その際にさせていただいたサイトは以下である。

<参考サイト>
https://qiita.com/hirohirox/items/7ac02c55b6a96611db64
https://qiita.com/Yoh_Yasushi/items/8e35473bf7adab480d83
https://users.miraclelinux.com/support/?q=node/397


SELinuxの無効化

SELinuxが有効の場合、batファイル、シェルスクリプト、サービスなどが
うまく実行できないことが起きたため、無効化することで解決した。

状態確認方法

$ getenforce
Enforcing

<状態一覧>
・enforcing … SELinux = 有効、アクセス制限 = 有効
・permissive … SELinux = 有効、アクセス制限 = 無効、警告のみ出力
・disabled … SELinux = 無効

一時的に無効化

$ setenforce 0
# 【結果】Permissive となる。

$ setenforce 1
# 【結果】Enforcing となる。

永続的に無効化

$ vi /etc/selinux/config
# 「SELINUX=enforcing」と、設定ファイルを書き換える

サーバ再起動

変更後、再起動しなければ反映されない。

$ reboot

Linuxのファイアウォール設定

# サービスの起動
$ systemctl start firewalld
# サービスの停止
$ systemctl stop firewalld
# 解放しているポートの確認
$ firewalld-cmd --list-all

ポートフォワーディングの設定(コマンドプロンプト)

※(注意)Linux のコマンドではなく、Windowsのコマンドである。

# ポートフォワーディングを設定
$ netsh interface portproxy add v4tov4 listenport={転送元(ホストOS)ポート} listenaddress={転送元のIPアドレス} connectport={転送先ポート} connectaddress={転送先のIPアドレス} 

# ポートフォワーディングしているものを表示
$ netsh interface portproxy show all

# ポートフォワーディングを設定
$ netsh interface portproxy delete v4tov4 listenport={転送元(ホストOS)ポート} listenaddress={転送元のIPアドレス}

備考

Linux コマンド一覧①
https://qiita.com/skull-eve/items/56661fa8ae5ac31185b2
Linux コマンド一覧②
https://qiita.com/skull-eve/items/7ea5773ca2fdddeafad9

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?