What is the etiquette? What do the passport control officers expect? I’m asking from the point of politeness and efficiency.
Saying hello indicates you speak at least some English, which avoids the need for the immigration officer to ask. They may be interested in your accent - if you have a characteristic accent from some part of the country you're visiting, but have not lived in that country, they may be suspicious. The same could apply if you try to speak a little of the local language that is not normally learned by tourists. In the pre-Schengen days, a German friend who had taught himself some Danish was treated with suspicion at the Danish border as they suspected him of living there without being documented.
As a Scot, I find it useful to exaggerate my Scottish accent at US immigration.
I’m a former Immigration Officer myself (in the UK).
Saying “hello” (or “good morning/evening” etc) is entirely appropriate, just like any other encounter in the English-speaking world. It distinguishes us from machines, acknowledging the human interaction. In other words, if you did not greet the officer then you may as well be using one of the automated passport gates.
You will frequently find the officer initiating the contact anyway. If the officer greets you, make sure to greet them back - otherwise you will appear rude. It’s just like any other human encounter.
I agree with what others have said though: beyond the initial greeting, don’t bother to engage in small talk (“how are you today?”), when the queue is long. Just say hello while handing over your passport, and thereafter answer any questions.
We also appreciate it if the passport is passed already open at the bio-data (photo) page for EEA/Swiss nationals; or if you’re a visa national, with the relevant visa page already open.
There's no strict rule.
If they say hello (good morning / good evening / etc.) when you walk up, say hello back.
If they say "Hi, how are you today?" then answer them.
If they just say "passport please", just hand over your passport. If they don't say anything, just quietly hand over your passport.
I usually say thank you when they hand everything back at the end but I'm sure if you don't they won't be particularly put out by it.
From the point of view of efficiency, make sure you know what documentation they will require at that particular point and have anything they might need to see from you to hand. It may just be passport, it may also be a landing card that you have to fill out before you get to the desk, they may want to know your flight number, details of your return itinerary, or ask about where you are staying.
You don't need to offer any of this documentation until it is asked for, but if you have all your travel related documentation in one easily-accessible location in your hand luggage, you will save yourself and them time if they need to ask you for anything else. From the point of view of somebody who is sitting there for however many hours one of their shifts is, I'm sure what they mainly want is for you to hand them what they need with minimal fuss and go on your way once they've ticked whatever boxes need ticking.
I personally (nearly) always say hello (just hello) while handing over my passport, even if they don't say anything. I'll often try to use the local version if I know it. Once finished, usually a thank you and/or goodbye. Beyond that, it's up to them.
I wouldn't go into any "how are you today" or anything like that unless they initiate it. They see hundreds or thousands of people, they're often not really in the mood for a chat, though this depends a bit on the culture, a bit like when you're greeted in a store: in the US for instance, you will annoyingly be asked how you are today by every single person within 10 feet, and some (but not all) US CBP officers will do the same. In most other places it won't go further than hello (if that) unless they have questions.
There's no particular etiquette. I usually say "Hello" or "Hi" when when I hand over my passport: it's a friendly thing to do and, in non-English-speaking countries, it hints that I'd like them to speak English to me. (Though they'd probably guess that from my British passport.)
Depends on the country. In the UK and US, for example, the officers greet me (and/or me them) whereas in former Yugoslavia, Albania, Moldova, Turkey and Georgia, they never say a word to me. The same is true IME when entering/exiting Singapore at Woodlands.
In the Schengen Area it varies.
(for what it's worth, I'm on a Swedish passport/ID card)
The last time I faced a passport control officer was at Barajas Airport (Madrid/Spain). It was my second time there and I felt SO happy that my smile was covering my whole face as I got off the plane and walked thru the customs hall.
When the agent noded me to walk five steps towards him and present him my passport I greet him smiling and he smiled me back with sympathy as he asked me the purpose of my trip.
We are all human. They have an awful job: looking for delinquent and terrorist among tons of happy tourists or angry business travelers. I can understand that they do not smile a lot at work, but you can show them a nice smile and say "Hi, good morning". It will not harm anyone. ;)
I believe it is hard for officers to say hi and bye to people in the row. Imagine! You are going to say it all through the working shift—non-stop!
If you say any greeting to the officer, it means you are somehow expecting or forcing him/her to reply the greeting, which is inconvenient!
I recommend to just smile instead of “hi” and move your head as bye with a little bit squeeze on your lips (something like a close smile). This means you care and appreciate but you do not expect a reply!
Simple cordiality is polite, but don't start spilling your guts or recounting your biography. These people are not your friend. They can send you to prison or to your death. Their notes may follow you around for life.
They are no more interested in being your friend than bar staff. They will also be trained to detect attempts at misdirection, and they may misunderstand a colloquialism as profanity or blasphemy, whichever is worse.
..and the longer the queue is held up, the more likely someone behind you will cause trouble. I went through T5 at Heathrow from Amsterdam late December last year, a three hour queue. Some idiot abused an officer and the officer walked off the job, leaving three officers for a thousand odd passengers. Some of which had problems with their entry cards, very trying for these people. Be nice, it's their workplace, but don't waste their time. They may have a KPI (key performance indicator) or SLA(Service Level Agreement) to meet.