how can I add an application to the "open with" menu ubuntu 11.10

Open the .desktop file in /usr/share/applications and see if the "Exec" line has a "%F" appended to it - if it is missing tag it on 

You will have to open as root ie:

Code:
gksu gedit /usr/share/applications/<filename>.desktop


'Linux' 카테고리의 다른 글

리눅스 웹 한글깨짐  (0) 2015.10.16
alias를 이용한 단축명령 만들기  (0) 2015.10.11
vim syntax, indent, linenumber 설정  (0) 2015.06.25
Linux commands  (0) 2015.06.24
How to uninstall and remove Apache2 on Ubuntu or Debian  (0) 2015.06.24

리눅스 웹 한글깨짐


리눅스로 웹 페이지를 구성할 때 한글이 깨져 나오곤 한다.

그 이유는 언어 인코딩 문제인데 리눅스는 보통 UTF-8 을 사용하는데 우리가 윈도우에서 사용하는 언어는 EUC-KR 인코딩셋으로 되어있다.

 

따라서 브라우저에서 인코딩을 UTF-8 로 설정해주면 잘 보인다.(웹페이지에서 우클릭후 인코딩->UTF-8)


자동으로 이 설정을 바꿔주기 위해서는 html 태그로 다음과 같이 해주면 된다.

 

<META HTTP-EQUIV="content-type" CONTENT="text/html; CHARSET=utf-8">

How to Use Aliases to Customize Ubuntu Commands

Using the command line seems rugged and unpleasant, but Linux has a way to ease things up and help you get things done with the command line by allowing you to use aliases to customize how you type commands.

Setting up Aliases

Aliases are a way for you to customize the commands by giving them aliases (nicknames). You can use them to remember hard commands or make short names to long commands you just hate to type. To setup aliases, right-click and create an empty file in your home directory and name it “.bash_aliases”. Notice the period at the beginning of the name that will make the file hidden. Press “Ctrl+H” to show the hidden files.

Aliases Syntax

Using your favorite text editor open the file you just created and start making your aliases. But there are few things you should keep in mind, the syntax should be:

alias new_name='old_command'

Where “new_name” is the alias, and “old_command” is the command you want to change and is put between quotes. Example:

alias agi='sudo apt-get install'

This will make typing “agi” the same as typing “sudo apt-get install”. This way if you have a dozen of packages to install, your task just got easier. Keep in mind that if you create an alias that looks the same as a command, then the command or alias will not work. Example:

alias install='sudo apt-get install'

The alias in the above example won’t work because there is already a command by the name “install”.

And remember that creating aliases from two words won’t work unless you connect them with a dash. Example:

alias apt install='sudo apt-get install'

alias apt-install='sudo apt-get install'

In the above example, the first alias is invalid as the alias consists of two separate words while the second alias is good to use because the two words are connected with a dash. And the last thing that you shouldn’t do is put any space at the starting of any line. So that’s everything about creating the aliases, but what aliases would you use? Keep reading!

What aliases to use

Now that you know how to setup aliases and create your own. Let’s see what aliases you can use to make the most out of it.

  • Manage packages

If you have to install and remove packages too often then you really are going to like this.

alias agi='sudo apt-get install'

alias agr='sudo apt-get remove'

alias agu='sudo apt-get update'

alias acs='apt-cache search'

The aliases above are made of the first letters of each word in the command. These are just examples of what you can use and you can use them, modify them or create your own.

  • Manage files and folders

alias cp='cp -iv'

alias mv='mv -iv'

alias rm='rm -i'

alias la='ls -alh'

These aliases will make the command line ask you for confirmation on deleting files or overwriting them (if there were duplicates) when copying or moving files as well as give you more information on what is being done. This can prevent you from accidentally overwriting your files or sending them to somewhere you shouldn’t send them to.

  • Navigating the system

alias documents='cd ~/Documents'

alias downloads='cd ~/Downloads'

alias desktop='cd ~/Desktop'

alias music='cd ~/Music'

alias videos='cd ~/Videos'

alias ..='cd ..'

alias ...='cd ../..'

alias ....='cd ../../..'

Now navigating your files and folders can be no easier. Type the directory you want to go to and type dots to go up.

  • Other useful aliases

alias e='exit'

alias s='sudo'

alias shutdown='sudo shutdown –h now'    #requires root password, disable it by "sudo chmod u+s /sbin/shutdown"

alias restart='sudo shutdown –r now'      #requires root password, disable it by "sudo chmod u+s /sbin/shutdown"

alias suspend='sudo pm-suspend'

alias lock='gnome-screensaver-command --lock'

alias mounted='mount | column –t



How-To: Raspberry Pi media SERVER (easy)

by jelleke60 » Fri Sep 20, 2013 8:59 pm

In this tutorial I will attempt to explain how to turn your Raspberry Pi in a media SERVER to stream media to your home network or even remote network.

This setup will allow the following:
    -> Stream movies/photo's/music TO your home network and remote network.
    -> Stream to any device (PC/laptop/XBMC/WD Live/Popcorn/Android/...)
    -> SRT support for movies
    -> HD support
    -> Using samba share and FTP share methods

You will need:
    -> Raspberry Pi with the latest Raspbian image installed http://www.raspberrypi.org/downloads
    -> internet connection to your PI
    -> External USB HDD with media content (ordered in seperate folders)
    -> Another device to stream the content to such as a laptop,media box, ...[/url]

Let's get started

You can use SSH to acces your terminal on the RPI from another device or use the terminal on the device itself by using a monitor/keyboard with the RPI.
In your terminal type the following:

Update your Repo's
CODE: SELECT ALL
sudo apt-get update

If you are going to use a NTFS based external hard drive (most are) (TIP: ext4 file systems are the fastest)
CODE: SELECT ALL
sudo apt-get install ntfs-3g

Now insert your usb hard drive in the RPI and wait untill it gets mounted. If it's mounted type the following
CODE: SELECT ALL
sudo df

A list of installed hard drives will appear. Write down your external HD's location. Mine was /dev/sda1. Type the following commands. (You might want to CHMOD your HDD folder permissions if you get permission errors later)
CODE: SELECT ALL
cd /media
sudo mkdir HDD
sudo nano /etc/fstab

A file will open, on the bottom of the file type the following and then exit and save the file (ctrl+x, Y, enter, enter). Remember to replace /dev/sda1 with your HDD location. Also replace ntfs-3g with vfat if your have a fat based HDD or ext4 for a ext4 filesystem. Whitespaces areTABS
CODE: SELECT ALL
/dev/sda1         /media/HDD       ntfs-3g     defaults,noatime      0        0

Back in terminal, type these commands
CODE: SELECT ALL
sudo umount /dev/sda1
sudo mount /dev/sda1

Your external Hard drive should now always be mounted in the folder HDD. So far so good, now lets install samba and vsftpd.
CODE: SELECT ALL
sudo apt-get install samba samba-common-bin
sudo apt-get install vsftpd
sudo apt-get install hdparm
sudo hdparm -S 240 /dev/sda1 ##DO THIS ONLY if you want to spindown your external hard drive when it's inactive for 20min, handy if you always want to keep everything powered.

Configure Samba, for home network share (skip if you only want a remote share)
CODE: SELECT ALL
cp /etc/samba/smb.conf /etc/samba/smb.conf.bak  //Make a backup of the config file
nano /etc/samba/smb.conf

when the file opens scroll to the bottom and paste the following, then save and exit
CODE: SELECT ALL
[media] 
comment = Media share
path = /media/HDD
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
read only = no

Now make an extra account to log into samba on another device
CODE: SELECT ALL
sudo service samba restart
sudo useradd ChooseUsernameHere -m -G users
sudo passwd TheChosenUsername //after this choose a password for the new user
sudo smbpasswd -a TheChosenUsername //after this enter passwd again

All set! Scroll to the bottom to see how to stream movies on another device now in the home network if you want to skip remote streaming.

Configure remote streaming
First make an extra user (if you skipped samba setup)
CODE: SELECT ALL
sudo useradd ChooseUsernameHere -m -G users
sudo passwd TheChosenUsername //after this choose a password for the new user

Configure vsftpd
CODE: SELECT ALL
sudo nano /etc/vsftpd.conf

##Edit or uncomment the following lines ::::
Anonymous_enable=NO
Local_enable=YES
Write_enable=YES
Ascii_upload_enable=YES
Ascii_download_enable=YES

##ADD the following lines to the bottom of the file!
pasv_enable=YES
listen_port=64000
pasv_min_port=64001
pasv_max_port=64040
pasv_address=YOUR REMOTE IP ADDRESS (lookup my ip on google)
pasv_address_resolve=YES
local_root=/media/HDD

important! Now go into your Router settings and forward port 64000 to 64040, to the local IP of your raspberry. Make sure everything has a static address, if you don't know how to do it then lookup another tutorial, there are plenty.
CODE: SELECT ALL
sudo service vsftpd restart

All done on the Raspberry Pi side! Now take your laptop/XBMC/mediabox!

On a PC/XBMC mediabox where you want to stream to

Note: it really helps if your video files on the HDD are properly ordered and in seperate folders with movie title.
If you are on a laptop/pc then install XBMC for windows/linux http://xbmc.org/download/.

Open XBMC and do the following (for video streaming on the HOME network)
    -> videos -> files -> add videos...
    Click browse and choose Windows network (SMB) (You could even map the share into a drive first in windows)
    -> Choose the raspberry out of the list and then the folder where your files are
    -> next choose movie scraper and make sure settings are ok, then scan the content, when it's done you should be able to stream movies from your RPI!

For REMOTE streaming
    -> videos -> files -> add videos...
    Click browse and choose Add network location
    -> protocol = FTP
    -> Address = your remote IP (the one from google)
    -> port = 64000
    -> username = the extra user you made before 
    -> pass = the users passwd
    -> click OK and then select it, now choose movie scraper and check the settings

Done! I hope you enjoy your new streaming device! 

For me, this works like a charm, i was able to watch HD movies in a Hotel abroad on my laptop, streaming from my RPI at home.
XBMC installs on almost everything (RPI, PC,Linux,Android) so you would be able to stream to all those devices using the above method.

Let me know what you think and ask questions if you like! Greets
Last edited by jelleke60 on Tue Oct 21, 2014 4:19 pm, edited 3 times in total.


'Linux > RaspberryPi' 카테고리의 다른 글

ftp명령어  (0) 2015.06.29
ftp확인  (0) 2015.06.29
raspberry pi network status  (0) 2015.06.29
라즈베리파이에 FTP서버 구축  (0) 2015.06.29
Raspberry Pi – Enabling Telnet  (0) 2015.06.29

The IP address 192.120.43.250 is the eth0 for my server. When I run the command

sudo vsftpd /etc/vsftpd.conf

I get the error:

500 OOPS: could not bind listening IPv4 socket

To check to see what was running on port 21, I ran the command:

sudo netsat -tulpn

And saw that vsftpd process id was 29383 so I issued the command:

sudo killserver 29383

And checked again. The vsftpd was still there, but with a different PID. Running the command:

sudo killall vsftpd

and

sudo killall -9 vsftpd

Does the same thing. I have already tried reinstalling. Anyone know what is going on and how to fix it?

'Linux > RaspberryPi' 카테고리의 다른 글

/etc/vsftpd.conf 설정 참조글  (0) 2015.06.29
ftp확인  (0) 2015.06.29
raspberry pi network status  (0) 2015.06.29
라즈베리파이에 FTP서버 구축  (0) 2015.06.29
Raspberry Pi – Enabling Telnet  (0) 2015.06.29

Testing

just go to the vsftpd directory and launch it
cd /storage/opt/vsftpd
./vsftpd vsftpd.conf

let's try a connection :
telnet 127.0.0.1 21
HELO
QUIT

'Linux > RaspberryPi' 카테고리의 다른 글

/etc/vsftpd.conf 설정 참조글  (0) 2015.06.29
ftp명령어  (0) 2015.06.29
raspberry pi network status  (0) 2015.06.29
라즈베리파이에 FTP서버 구축  (0) 2015.06.29
Raspberry Pi – Enabling Telnet  (0) 2015.06.29

Just to add to this useful advice you can see which process is listening at which port by using the command as root :

Code:
netstat -apn


'Linux > RaspberryPi' 카테고리의 다른 글

ftp명령어  (0) 2015.06.29
ftp확인  (0) 2015.06.29
라즈베리파이에 FTP서버 구축  (0) 2015.06.29
Raspberry Pi – Enabling Telnet  (0) 2015.06.29
Raspberry Pi에서 Java 설치하기!  (0) 2015.06.25
Home » 산딸기 서버 » 라즈베리파이 서버 활용 강좌 : 라즈베리파이에 FTP서버 구축

안녕하십니까.. 산딸기 마을에 이장 나무꾼 입니다.

오늘은 라즈베리파이 서버군 중 파일서버의 한 종류인 FTP Server 를 설치 및 환경설정을 해 보도록 하겠습니다.

 

라즈베리파이 FTP Server 구축하기

 

0. 파일서버의 정의

위키디피아 에서는 파일서버에 대한 정의를 아래와 같이 표현하고 있습니다.

컴퓨팅 환경에서 파일 서버(file server)는 워크스테이션이 접근할 수 있는 컴퓨터 파일(문서, 사운드 파일, 사진, 영화, 그림, 데이터베이스 등)을 공유하고 있는 기억 공간의 위치를 제공하는 것이 주 목적을 가진 네트워크에 추가된 컴퓨터를 말한다.”서버”(server)라는 용어는 클라이언트 서버 구조로 된 기기의 역할을 강조하며 여기서 클라이언트는 이 기억 공간을 사용하는 워크스테이션을 말한다.
파일 서버는 일반적으로 어떠한 계산도 수행하지 않으며 클라이언트의 중간에 어떠한 프로그램도 실행하지 않는다. 데이터의 빠른 저장과 워크스테이션이 중대한 계산을 제공하는 데이터 수신이 파일 서버의 주된 설계 목적이다.

간단히 표현하자면 내부 또는 외부에서 파일서버가 구축되어 있는 네트워크 공간으로 접속을 하여 파일을 전달 받을 수 있는 컴퓨터 구성환경 이다.

그럼, 이제 본격적으로 사용 중인 R-Pi에 FTP Server 를 설치 해보도록 하겠습니다.

 

1. 준비 사항.

o Raspberry Pi 본체
o Pre-install Raspbian SD 메모리카드

 

2. vsftpd 설치하기 

apt-get install 설치실행 명령어로 FTP Server 프로그램 중 vsftpd 을 설치합니다.

sudo apt-get install vsftpd
vftpd_1그림 2-1)

 

3. vsftpd.conf 파일 설정하기

2번에서 처럼 vsftpd 프로그램이 정상적으로 설치가 되었다면, 외부 또는 내부에서 FTP접속이 가능하도록 /etc/vsftpd.conf 파일을 열어 일부 내용을 수정을 합니다.

sudo nano /etc/vsftpd.conf

vftpd_2

그림 3-1) 

vftpd_3

그림 3-2) 
# anonymous 사용자의 접속 허용 여부, 즉 anonymous ftp (default = YES)
# 공개된 형태의 FTP 서버로 운영할 것이 아니라면 NO로 한다.
 anonymous_enable=NO
# 로컬 계정 사용자의 접속 허용 여부 (default = NO)
 local_enable=YES
# write 명령어 허용 여부 (defualt = NO)
write_enable=YES
# 로컬 계정 사용자용 umask (default = 077)
local_umask=022
# anonymous 사용자가 파일을 업로드 할 수 있는지 여부 (default = NO)
# anon_upload_enable=YES
# anonymous 사용자의 디렉토리 생성 허용 여부 (default = NO)
# anon_mkdir_write_enable=YES
# 파일 전송 로그를 남길 것인지 여부 (default = YES)
 xferlog_enable=YES
# xferlog 표준 포맷으로 로그를 남길지 여부 (기본 설정파일은 YES)
# 아래에서 NO로 설정했을 때를 설명함
 xferlog_std_format=YES
# 파일 전송 로그 파일명
xferlog_file=/var/log/vsftpd.log
# FTP 서버 접속할 때 로긴 메시지 (default = vsFTPd 버전번호)
# 한글 사용 가능
# ftpd_banner=Welcome to blah FTP service.
# 사용자의 홈디렉토리를 벗어나지 못하도록 제한하기 위한 설정 (default=NO)
# 제한이 필요할 경우 YES로 바꾼 후 제한할 사용자 ID를 chroot_list_file= 에 설정한 파일에
# 지정한다.
# chroot_local_user= 설정과 관련이 있으니 '3. 문제 해결'을 꼭 읽어보라.
#
# chroot_list_enable=YES
# chroot_list_file=/etc/vsftpd.chroot_list
# ----------------------------------------------------------------
# 기본 설정 파일에는 없는 설정값으로 필요한 설정만 추가한다.
# ※ 중요한 설정은 굵은 글씨로 표시
# ----------------------------------------------------------------
# PAM 파일명을 지정 (설치할 때 /etc/pam.d/vsftpd명으로 복사함)
pam_service_name=vsftpd
# wtmp에 로그 남기기 (YES로 해야만 last 명령어로 접속 여부 확인 가능)
session_support=YES
# 사용자가 자신의 home directory를 벗어나지 못하도록 설정
chroot_local_user=YES
# 새로운 디렉토리에 들어갔을 때 뿌려줄 환경 메시지를 저장한 파일명
# message_file=.message
# xferlog 형식으로 log를 남기려면 (위에서 이미 YES로 했음)
# xferlog_std_format=NO
#
# - xferlog 표준 포맷은 로긴, 디렉토리 생성등의 로그를 남기지 않음
# 그러나 vsftpd 스타일 로그는 이를 포함한 보다 상세한 로그를 남김
# - vsftpd 스타일 로그 예
#
# Sun Jul 12 01:38:32 2003 [pid 31200] CONNECT: Client "127.0.0.1"
# Sun Jul 12 01:38:34 2003 [pid 31199] [truefeel] FAIL LOGIN: Client "127.0.0.1"
# Sun Jul 12 01:38:38 2003 [pid 31199] [truefeel] OK LOGIN: Client "127.0.0.1"
# Sun Jul 12 01:38:41 2003 [pid 31201] [truefeel] OK MKDIR: Client "127.0.0.1", "/mp3"
# Sun Jul 12 01:39:06 2003 [pid 31201] [truefeel] OK UPLOAD: Client "127.0.0.1", "/델리
# 스파이스 5집 - [04]키치죠지의 검은 고양이.mp3", 6855473 bytes, 3857.39Kbyte/sec
# 전송속도 제한 (0은 제한없음, 단위는 초당 bytes)
 anon_max_rate=0
 local_max_rate=0
 trans_chunk_size=0
# 최대 접속 설정 (단 xinetd를 통하지 않고 standalone으로 동작할 때만 사용 가능)
# standalone을 위해서는 listen=YES 추가하고 별도로 vsftpd를 띄워야 함
#
# max_clients=최대 접속자 수, max_per_ip=IP당 접속 수
# max_clients=100
# max_per_ip=3
# Standalone 으로 운영할 때 listen=YES. 포트 변경을 원할 경우 listen_port 설정
# 디폴트 포트는 21번 포트이다.
# listen=YES
# listen_port=21

 

[ 참고사이트]

https://security.appspot.com/vsftpd.html
http://jobdahan.net/server_linux/651905


'Linux > RaspberryPi' 카테고리의 다른 글

ftp확인  (0) 2015.06.29
raspberry pi network status  (0) 2015.06.29
Raspberry Pi – Enabling Telnet  (0) 2015.06.29
Raspberry Pi에서 Java 설치하기!  (0) 2015.06.25
Setting Up VNC  (0) 2015.06.24

Raspberry Pi – Enabling Telnet

In the next step in my series in using the Raspberry Pi for Network Engineers, I will cover the installation of Telnet on the RPi. Telnet is not secure and shouldn’t be used in a production environment unless there is no other choice. You start the process of installing Telnet by using the command sudo apt-get install telnetd. After Telnet has been installed, you will need to get the service starts. You can do it by using the command sudo /etc/init.d/openbsd-inetd restart or by rebooting the RPi.

Once you have the service ready, you can verify this by using the netstat -a command. You should see something like this from the RPi –

pi@raspberrypi:~$ netstat -a | grep telnet (with no telnet session on RPi active)
tcp 0 0 *:telnet *:* LISTEN

If you repeat the command with a telnet session active on the RPI, your should see this –

pi@raspberrypi:~$ netstat -a | grep telnet (with an active telnet session on RPi)
tcp 0 0 *:telnet *:* LISTEN
tcp 0 0 raspberrypi.loca:telnet 192.168.15.161:49610 ESTABLISHED

In a production environment, you should limit who can access the RPi via Telnet. You can do so with the /etc/hosts.allow file. Using this example (changing the ip address for the address of the workstation you are testing from) will block access to that workstation on Telnet –

add a line like this to /etc/hosts.allow to block a specific host –
in.telnetd : 192.168.15.161 : deny

Finding the name of the process to put in the hosts.allow file involved looking at the/var/log/syslog file to identify the running process involved. That is what told me that I needed to use in.telnetd instead of telnet or telnetd that I had first tried. Anytime that you make a change to the hosts.allow file, you will need to restart the inetd process – sudo /etc/init.d/openbsd-inetd restart.

If you want to allow only a specific workstation to get in via Telnet and block all others, you would use something like this –

in.telnetd : 192.168.15.162 : allow
in.telnetd : 192.168.15. : deny

Using only 192.168.15. acts like a wildcard and blocks all workstations that didn’t match on the earlier rule.

If you want to remove Telnet, you will use sudo apt-get remove telnet.

To see more of my posts about the Raspberry Pi, please go tohttp://www.ronnutter.com/category/raspberry-pi/


'Linux > RaspberryPi' 카테고리의 다른 글

raspberry pi network status  (0) 2015.06.29
라즈베리파이에 FTP서버 구축  (0) 2015.06.29
Raspberry Pi에서 Java 설치하기!  (0) 2015.06.25
Setting Up VNC  (0) 2015.06.24
시작시 Auto running programs  (0) 2015.01.03

vim syntax, indent, linenumber 설정


맨바깥에 .vimrc파일을 만든다음에 다음 내용을 추가한다.



  1 " Syntax Highlighting

  2 syntax on

  3

  4 " Auto Indent

  5 set autoindent

  6 set cindent

  7

  8 " Numbering

  9 set nu



"는 주석!!



+ Recent posts