Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've setup my own repository which I want to use SSH as the protocol. I managed to get everything working with an SSH key using port 22.

Now, I would like to change the SSH port. I've already changed it on the SSH/repo server. Now I can't figure out how to change apt to use a custom port on the client computer.

My sources.list file line which worked over port 22:

deb ssh://user@1.1.1.1/home/user/repo lenny main contrib non-free 

I've tried:

deb ssh://user@1.1.1.1:12345/home/user/repo lenny main contrib non-free 

and it fails and actually says "failed connecting to port 22"

Can this be done? I've searched google for hours and I getting nothing but unrelated data. I've read the man pages. The man page for apt.conf specified that you can set the port this way for HTTP, but doesn't mention anything about ssh ports.

Also, a secondary question:

Can I somehow specify which SSH identity/key file to use for apt?

Thanks.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

I'd have expected the port setting to work — the behavior you describe sounds like a bug. But you don't need apt's cooperation here, you can use .ssh/config instead. Create an alias for the apt repository machine and put the options you want:

Host my-apt-repository
HostName 1.1.1.1
User user
Port 12345
IdentityFile /path/to/private_key.id_rsa

Depending on your method for gaining root permission, you might need to put this in /root/.ssh/config as well as ~/.ssh/config.

share|improve this answer
    
Thanks. I didn't even think about doing something so simple. –  mhost Oct 1 '10 at 17:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.