Notice
Recent Posts
Recent Comments
Link
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Archives
Today
Total
관리 메뉴

Astro Coke

[Cygwin] Import User Path Variable in Windows when access with SSH 본문

Computer Setup

[Cygwin] Import User Path Variable in Windows when access with SSH

astrodoo 2019. 4. 4. 10:44

SSH 로 접속을 했을 때, Cygwin 이 Windows 의 User Path Variable 을 읽어들이지 않고 System Path Variable 만 읽어들인다.

 

비슷한 경우:

https://superuser.com/questions/547098/does-cygwin-import-user-variables-or-just-system-variables

 

Does Cygwin import user variables or just system variables?

I can see windows system variables in cygwin with echo $MYVar However, user variables don't seem to work. I'm referring to the variables you set in system properties->advanced->environment varia...

superuser.com

http://smithii.com/node/44

 

Cygwin Doesn't Register All Environment Variables When Using SSH | smithii.com

When initiating a Cygwin bash session via SSH, Cygwin only registers the environment variables for the SYSTEM account, not for the individual user's account. So I added the following code to the end of my .bashrc file: if [ "$SSH_TTY" ]; then pushd . >/dev

smithii.com

이를 해결하기 위해서는 위의 두번째에서 알려주는 방법을 쓸 수도 있지만,

내 경우에는 에러가 발생했다.

 

가장 간단한 방법은 

SSH로 접속할 때에만 따로 User Path Variables 을 .bashrc 에 추가하는 것이다. 

 

.bashrc 의 맨 아래에 다음과 같이 추가하면 된다.

 

ex)

if [[ -n "$SSH_TTY" ]]; then

    export PATH="$PATH:/cygdrive/c/Users/astrodoo/Anaconda3:/cygdrive/c/Users/astrodoo/Anaconda3/Scripts"

fi